Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@edirect/frontend-foundations

Package Overview
Dependencies
Maintainers
26
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@edirect/frontend-foundations

Frontend Foundations

  • 0.0.35
  • npm
  • Socket score

Version published
Weekly downloads
45
increased by73.08%
Maintainers
26
Weekly downloads
 
Created
Source

N|Solid

Foundations

The foundations of the design system

Build Status

Features

  • New components: Row, Column, Typography and Icons;
  • Patterns with regards to spacing, colours and shadows;
  • It is ready to be used in any frontend application that uses React.
  • All of the components are styled-components based, so you can easily extend them and apply some customization.

Installation

Frontend Foundations requires Node.js v14+ to run.

Install into your project:

npm i @edirect/frontend-foundations

For development environments:

git clone git@bitbucket.org:gofrank/frontend-foundations.git
cd frontend-foundations
npm install
npm run storybook

Plugins

Frontend Foundations is currently extended with the following plugins. Instructions on how to use them in your own application are linked below.

PluginREADME
Styled ComponentsLink to Github
StorybookLink to Github

Screen breakpoints:

These foundations have some screen breakpoints and they are categorized by the min and max screen size of the user agent.

BreakpointScreen Size
XS<= 412px
SM412px - 1430px
MD1440px - 1559px
LG>= 1600px

How to use the components:

First of all you need to wrap your frontend application with bolttech theme provider. This theme provider receives a theme the schema that can be imported to be used by default or be extended to be used by other partners and/or flows.

Example:

import { BolttechThemeProvider, bolttechTheme } from '@edirect/frontend-foundations';

const MyApp = () => (
  <BolttechThemeProvider theme={bolttechTheme}>
    <App />
  </BolttechThemeProvider>
);

export default MyApp;

After wrapping your app with the bolttech theme provider, you will be able to use all of these components below.

- Row

The Row component has some left and right margin-based in the size of the screen. Using the breakpoints we have these left/right margins:

BreakpointMargin
XSspacingXS (16px)
SMspacingS (24px)
MD or LGspacingM (32px)

If you want to remove these margins, you just need to set true to the prop fullWidth. Example:

import { Row } from '@edirect/frontend-foundations';

<Row fullWidth={true}>
  <ChildComponent />
</Row>;

- Column

Column component is a component who uses FlexBox to define the size of the container. Designers and devs need to be aware that each screen breakpoint have a size to be filled. The possibilities of each breakpoint will be available below:

BreakpointMargin
XS100%, 50%, 33% and 25%
SM100%, 50%, 33%, 25%, 20% and 16%
MD and LG100%, 50%, 33%, 25%, 20%, 16% and 8,3%

Note: Devs, please respect these sizes above to maintain consistency.

Props
PropTypeDescriptionExample
childrenReactElement or ReactElement[]--
classNameStringString containing a list of classes that need to be applied into the Column."bg-secondary-base"
sizeObjectObject containing the size of the column for each breakpoint.{ xs: '25%', sm: '50%', md: '100%', lg: '50%' }

Example:

import { Column, Row } from '@edirect/frontend-foundations';

const MyComponent = () => (
  <Row>
    <Column size={{ xs: '50%', sm: '50%', md: '50%', ld: '50%' }}>Hello</Column>
    <Column className="bg-primary-base" size={{ xs: '50%', sm: '50%', md: '50%', ld: '50%' }}>
      World
    </Column>
  </Row>
);

Typography

Typography is a text component that can assume a lot of sizes determined by the design team. Is easy to use and has a lot of props that can have the best fit for your component.

Props
PropTypeDescriptionExample
childrenReactElement, ReactElement[], string[], string, number[], number, boolean--
classNameStringString containing a list of classes that need to be applied into the Typography."text-secondary-base"
elementStringSets the HTML element to be used on this Typography component.h1, span, p and etc...
typeStringSets the font size, weight, and height based on the foundations to be used on this Typography component.displayL, bodyM, labelS and etc...
alignStringSets the alignment of the text.left, center or right

Example:

import { Typography } from '@edirect/frontend-foundations';

const MyComponent = () => (
  <Typography element="h5" type="displayBoldS" align="center">
    Welcome to bolttech!
  </Typography>
);

Icon

Using the same approach of the Column component, Icon has the size prop that uses the breakpoints of the foundations.

PropTypeDescriptionExample
colorNameStringString containing a name of the color that will to be applied into the Icon. You need to follow the format "{colorCategory}-{colorName}""secondary-base"
iconNameStringSets the SVG file correlated with the icon name. Click here to access the icon list.content/call
sizeObjectObject containing the size of the icon for each breakpoint.{ xs: '24px', sm: '32px', md: '32px', lg: '48px' }

Example:

import { Icon } from '@edirect/frontend-foundations';

const MyComponent = () => (
  <Icon iconName="action/policy" colorName="primary-base" size={{ xs: '12px', sm: '24px', md: '32px', ld: '32px' }} />
);

Helper classes

To help the development, we decided to add helper classes to be added to text, backgrounds and fill SVGs. Each colour of the theme has 3 classes to change the colours of the background, text and SVGs.

Example:

ColorText ClassBackground ClassSVG Class
Cyan -- primary-base (#00BAC7)text-primary-basebg-primary-basefill-primary-base
Navy -- secondary-base (#170F4F)text-secondary-basebg-secondary-basefill-secondary-base
Yellow (600) -- accent-600 (#E9E133)text-accent-600bg-accent-600fill-accent-600

Default Theme - bolttech

The foundations came with a preset of colors, paddings, spacings, typography and tokens, these presets are the default theme or bolttech theme.

Here is the structure of theme:

type bolttechTheme = {
  colors: ColorsType;
  spacing: SpacingType;
  typography: TypographyType;
  effects: EffectType;
  components: Record<string, unknown>;
  tokens?: Record<string, unknown>;
};

Generating your own theme

In some cases you will need to create a theme for a specific partner and/or flow. Based on that, we created a tool that can do this task for you.

Requirements: node 16 and npx.

How to use: First, you need to install the @edirect/frontend-foundations package globaly, you can do this by running the following command:

npm i -g @edirect/frontend-foundations

After installing the package, you can run this command with the following parameters to generate your theme:

npx @edirect/frontend-foundations generate-theme ${path-to-tokens-file} ${path-to-save-theme}

Example:

npx @edirect/frontend-foundations generate-theme /home/dev/Downloads/token.json ./src/style/themes/fwdgi

Note: the tokens file has a specific structure that it has to follow for this command to work, so be sure that the you are using a base file provided by the Design team.

Runing this command will generate the following structure (the files created by this command are the ones marked with the + symbol):

project
│---README.md
└───node_modules
└─── ...
└─── src
    └─── ...
    └─── style
        └─── themes
            └─── ...
            └─── + fwdgi
                └─── + theme
                      │--- + colors.ts
                      │--- + components.ts
                      │--- + effects.ts
                      │--- + index.ts
                      │--- + spacing.ts
                      │--- + typography.ts
                └─── + tokens
                      │--- + color.ts
                      │--- + effect.ts
                      │--- + index.ts
                      │--- + spacing.ts
                      │--- + typography.ts

FAQs

Package last updated on 17 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc