Files
remark42/frontend
dfcf728e6f Site (#1049)
by @akellbl4 

* create infrastructure for site

* wip

* fix docker build and add readme

* add docker-compose as a build and a run method

* rename compose file yaml -> yml

* add `src` as volume for watching changes

* update configs

* update README

* add padding at the end of the pages

* move demo settings in config

* fetch latest release from github

* update docs navigation

- add sections
- redirect from root of the section to first doc
- nice styles for navigation
- add brand colors

* cache github data from first load

* add redirects and fix link to docs

* fix docs nav styles

* add installation page placeholder

* fix demo

* add 404

* add dark theme, add theme switcher, remove unused files

* fix dark theme on main page

* fix dark theme background

* fix node version

* change installation docs

* add note block

* minor fixes

* add code highlighting styles

* fixes

* fixes

* mobile navigation, fix code highlighting colors

* fix dev server

* fix fetching error

* fix path to edit

Co-authored-by: Pavel Mineev <pavel@mineev.me>
Co-authored-by: Dmitry Verkhoturov <paskal.07@gmail.com>
2021-06-13 18:44:49 -05:00
..
2021-05-06 15:39:57 -05:00
2021-05-03 14:00:14 -05:00
2021-06-03 00:56:16 -05:00
2021-01-29 03:17:10 -06:00
2021-02-24 17:42:02 +03:00
2021-06-13 18:44:49 -05:00
2021-01-12 13:39:26 -06:00
2021-01-12 13:39:26 -06:00
2021-01-12 13:39:26 -06:00
2021-03-04 12:02:46 -06:00
2020-09-06 14:15:56 -05:00
2021-03-04 12:02:46 -06:00
2021-01-12 13:39:26 -06:00
2021-05-06 16:10:25 -05:00
2021-01-12 13:39:26 -06:00
2021-05-06 16:10:25 -05:00

Frontend guide

Code Style

  • project uses typescript to statically analyze code
  • project uses eslint and stylelint to check frontend code. You can manually run via npm run lint.
  • git hooks (via husky) installed automatically on npm install and check and try to fix code style if possible, otherwise commit will be rejected
  • if you want IDE integration, you need eslint and stylelint plugin to be installed.

CSS Styles

  • now we are migrating to css-modules and this is recomended way to stylization. A file with styles should be named like component.module.css
  • old component styles use BEM notation (at least it should): block__element_modifier. Also there are mix classes: block_modifier.
  • new way to naming CSS selectors is camel-case like blockElemenModifier and use classnames to combine it
  • component base style resides in the component's root directory with name of component converted to kebab-case. For example ListComments style is located in ./app/components/list-comments/list-component.tsx
  • any other files should be named also in kebab-case. For example ./app/utils/get-param.ts

Imports

  • imports for typescript, javascript files should be without extension: ./index, not ./index.ts
  • if file resides in the same directory or in subdirectory import should be relative: ./types/something
  • otherwise it should be imported by absolute path relative to src folder like common/store which mapped to ./app/common/store.ts in webpack, tsconfig and jest

Testing

  • project uses jest as test harness.
  • jest check files that match regex \.(test|spec)\.ts(x?)$, i.e comment.test.tsx, comment.spec.ts
  • tests are running on push attempt
  • example tests can be found in ./app/store/user/reducers.test.ts, ./app/components/auth-panel/auth-panel.test.tsx

How to add new locale

Please see this documentation.

Notes

  • Frontend part being bundled on docker env gets placed on /src/web and is available via http://{host}/web. for example embed.js entry point will be available at http://{host}/web/embed.js