-
-
Notifications
You must be signed in to change notification settings - Fork 184
Frontend Development
Leszek Pietrzak edited this page Jul 22, 2021
·
16 revisions
We use multiple different libraries that forces the code to be consistent. Please make sure your code editor has all possible plugins installed!
- we use spaces 🙊
- JSDoc currently we comment everything, but will be dropping it when we move to TypeScript
- editorconfig (our config) - best set it to autofix on file save
- prettier (our config) - as for now please use it only on files you've edited in a great way, or on new files
- eslint (our config)
- stylelint (our config)
- coffeelint (our config)
- we prefer
() => {}
overfunction () {}
for unnamed callback functions for brevity
Some rules we follow:
- only one React component per file
- generally we prefer smaller files
- when creating new React component:
- you should create all it's files next to it, e.g.:
jsapp/js/components/submissions/table.es6 jsapp/js/components/submissions/table.tests.es6 jsapp/js/components/submissions/table.scss
- import styles file in the component
.es6
file
- you should create all it's files next to it, e.g.:
- group
.es6
files by feature, e.g.library/
,submissions/
- generic/common React components go to
jsapp/js/components/common
directory - don't use relative paths in imports
Some notes first:
- we generate an icons font from
svg
files using webfonts-generator package - the source of the icons is the Sketch file from our Google Drive:
/Kobo Product Design/Design Current/04. Design/Comps Sketch/Icons.sketch
- all the icons need to have the same artboard size (
webfonts-generator
requirement) - after kpi#3305 is done, this will be much simpler 😇
Steps to take when adding new icon:
- Open
Icons.sketch
- Create new artboard
Icons/<icon-name>
, make sure it is exportable (easiest way is to clone an existing one) - Draw the icon or drag&drop existing SVG file, make sure the paths are combined and the color is black (
#000000
) - Export all icons
- Copy new icon from
Icons/<icon-name>.svg
tojsapp/svg-icons
in KPI repository - Run the new
svg
file through ImageOptim.app or some alternative non-destructive SVG compressor - Run
npm run generate-icons
- Use your new icon:
<i className='k-icon k-icon-<icon-name>'/>