@tdcerhverv/parrotfish
v3.3.11
Published
TDC Erhverv - Shared Styles constants imported from Figma
Downloads
888
Readme
Parrotfish
IMPORTANT NOTE:
dist
is part of the repo to have control over what icons are being build with what version of parrotfish, see 2. Versioning strategy
Builds ready-to-use react components and svg files directly from figma.
Uses figma api: https://www.figma.com/developers/docs.
Build assets using npm run generate-all
- will auto-generate svg files and react component from figma.
Pushing to master
is not allowed; please create a branch.
Be sure to follow steps
- UI Upgrades
- Versioning strategy for any new additions and create a pull-request on github against the
master
branch.
Questions? Reach out to:
UI Upgrades (for adding new icons / colors, or changing existing)
In case of UI Upgrades started in UX Chapter (such as new CVI), the following describe the process for bumping new versions of design tokens:
- Make sure the Figma page ids are passed correctly in all necessary
generateDesignToken(SourceFigmaPages, DesignTokens)
; the parameters are controlled by enums found in./enums/*.enums.ts
npm run generate-all
ornpm run generate-colors
ornpm run generate-icons
npm version major
, commit and push in order to trigger auto-publish; thennpm install @tdc-packages/[email protected]
the new version you just created in your project.
Need help debugging? See debug section
Versioning strategy
This package is NOT using semver conventions, due to the need of versioning both code & assets. Therefore, use these guidelines when applying npm version <versionType>
:
- major: UX chapter specifically names a CVI-version (optional) and changes all assets entirely
- minor: breaking code changes
- patch: new icon added / new color added in Figma
!! Please update the ./packages/parrotfish/CHANGELOG.md
with all changes referred above.
Debug
PREREQUISITES: follow Figma's authentication guide and once you've got a
developer access token
, add it to your environment variables, mapped toFIGMA_TOKEN
npm run generate-all
if all design-tokens have changed and check if the generated assets look correct.- Fragmented approach: (see
package.json/scripts
)npm run generate-colors
for fetching new colors from figma;npm run generate-icons
for fetching new icons from figma;npm run generate-react-icons
for generating react components from icons from figma;
Usage
Install via npm i @tdcerhverv/parrotfish
;
Please note using the SVG icons requires you to have something like @svgr/parcel-plugin-svgr
(>= 4.x) installed, if you are using Parceljs of course. 😉
React Component Icon example:
import AccountNumber from '@tdcerhverv/parrotfish/icons/AccountNumber';
SVG icon example
import Account_number from '@tdcerhverv/parrotfish/dist/icons/Icons/Account_number.svg';
Design tokens
- SCSS color variables:
- using GET: https://api.figma.com/v1/files/FIGMA-COLOR-FILE-ID
- color pages:
- master 1.5: CWDhhHgxEb7AEQFKl56RHGvt
- developer + ux signoff color page ID: Xx1z0Lcl7j8JhXwFLTU3sdbB
<< currently in use
- should be imported from
dist/colors-design-token.scss
- format:
$color-cerulean-blue-40: rgba(255, 0, 130, 1);
- theme format (recommended):
map-get('primary', $theme);
- TS color variables:
- using GET: https://api.figma.com/v1/files/FIGMA-COLOR-FILE-ID
- color pages:
- master 1.5: CWDhhHgxEb7AEQFKl56RHGvt
- developer + ux signoff color page ID: Xx1z0Lcl7j8JhXwFLTU3sdbB
<< currently in use
- should be imported from
dist/colors-design-token.ts
- format:
theme.primaryLight: '#2d80d3'
- colorsMap exported as default. keys are formatted with camelCase (example:
primary-light
->primaryLight
)
- Icon SVG:
- using GET: https://api.figma.com/v1/files/FIGMA-ICONS-FILE-ID & subsequent recursive https://api.figma.com/v1/images/M2McmXIlBunFDCdim0z5anm4?ids=FIGMA_IDS_COMMA_SEPARATED&format=svg
- required peer dependency: @svgr/parcel-plugin-svgr
- icons pages:
- shared components / icons: M2McmXIlBunFDCdim0z5anm4
- should be imported from
dist/icons/ICON_GROUP/ICON_NAME
- example:
import Account_number from '@tdcerhverv/parrotfish/dist/icons/Regular/Account_number.svg'