6.1.2 • Published 22 days ago

@jet-pie/react v6.1.2

Weekly downloads
10
License
Apache-2.0
Repository
-
Last release
22 days ago

Pie Project - React Components

This package implements the PIE design system for React. You can see it in action here.

Tech Stack

Adding to your project

Setup

To include @pie/react into your project, first thing you need to do is to authenticate your project to install Skip's NPM registry dependencies. To do that create a file .npmrc in the root of your project, then ask for one of the project maintainers for the keys to add to that file.

Finally add @pie/react running yarn add @jet-pie/react. Remember to be connected to the VPN. There are some peer dependencies that the project requires that you might be requested to add them, such as styled-components.

Theme Provider

Our components need specific fonts and styles, which are provided via styled-components.

The PIEThemeProvider component takes care of providing the theme and loading the fonts. To use it, add this component to the top of you component tree, wrapping the rest of the application as children.

It also allows you to consume the Theme in your application using styled-components's template functions. All tokens values will be accessible via the theme property:

export const MyLocalComponent = styled.div`
  background-color: ${(props) => props.theme.colors.value.orange};
`;

NOTE: Make sure every @pie/react component and your components that consume the theme to be wrapped by the PIEThemeProvider.

Customization

We don't treat customization as a first-class citizen. Our colors, spacing, and fonts were handpicked by designers to provide the best UI/UX and have consistancy across different products. Having fully customizable components would go against those principles.

Be that as it may, the library allows customizations in two ways:

  • Component Based: Some of our components have props that allow customizing the colors and behaviour of the component. This is a more restrict approach as not all components allow to do this type of customization. I.e., the Progress Bar allows you to add different progress states and colors.

  • Theme Based: Its possible to customize the PIE theme. The PIEThemeProvider component has a customTheme prop that allows you to override values from the original theme. CAUTION: Changes to the theme could affect all components, cause unexpected behaviour and possibly break your application.

Extending the Theme

If your app needs token values that the PIE Theme does not have, you're welcome to add them! You will be able to consume same way as the rest of the theme.

To do that, pass your custom properties to the PIEThemeProvider:

const const customTheme = {
  magentaColor: 'magenta',
};

 <PIEThemeProvider extraProperties={customTheme}></PIEThemeProvider>

Now you can get those values using styled-components template functions. They will all be inside the custom property.

export const MyLocalComponent = styled.p`
  color: ${(props) => props.theme.custom.magentaColor};
`;

Guidelines

Component File Structure

Components on PIE are found following this structure:

  • Component.story.tsx: Story file to display the component and interact with it on Storybook
  • Component.tsx: Actual implementation of the component
  • styles.tsx: Export all styling need for the component (and Story)
  • types.tsx: Export types definitions for the component

You don't have to strictly follow this structure per se. You can have a different structure based on the requirements of your component, as long as it has a similar separation of concerns.

Project helpers

We have a couple function that will help you extract values from our Theme:

getColorAlias

Strongly typed helper to get the color alias values from the theme. It allows us to handle different themes (default/dark) without having to worry about it in a component level.

The alias needed for each color of your component should be specified in the tech ticket.

NOTE: Dark theme has not been implemented

export const PrimaryButtonSmall = styled(ButtonSmall)`
  background-color: ${getColorAlias('interactivePrimary')};
  color: ${getColorAlias('contentnteractive-primary')};
`;

getFontSize

We have 8 font sizes avaliable on PIE: size-a throught size-h. As a design decision, not only we set the font-size, but also the line-height.

Using this helper will set both properties based on the font alias used:

export const RangeWrapper = styled.div`
  ${getFontSize('sizeC')};
  font-family: ${(props) => props.theme.font.familyPrimary};
  width: 100%;
`;

Styled Components for styling

When styling your components, focus on only using Styled Component concepts. There is no need to create CSS files, CSS variables or even CSS classes!

DONT DO THIS

export const GhostButtonMedium = styled(ButtonMedium)`
  background-color: ${({ isLoading }) =>
    isLoading
      ? opacifyAliasColor('active02', 'backgroundDefault')
      : 'transparent'};
  color: ${getColorAlias('contentLink')};

  color: ${getColorAlias('contentLink')};

  .spinner svg {
    stroke: ${getColorAlias('contentLink')};
  }
`;

DO THIS

export const SpinnerWrapper = styled.div`
  // DEFAULT STYLING
`;

export const GhostButtonMedium = styled(ButtonMedium)`
  background-color: ${({ isLoading }) =>
    isLoading
      ? opacifyAliasColor('active02', 'backgroundDefault')
      : 'transparent'};
  color: ${getColorAlias('contentLink')};

  // Styling for GhostButtonMedium
  ${SpinnerWrapper} svg {
    stroke: ${getColorAlias('contentLink')};
  }
`;

Adding a new component

TBD

Reviewing process

TBD

Running locally

TBD

Maintainers

6.1.3-alpha.0

22 days ago

6.1.2

2 months ago

6.1.2-alpha.1

2 months ago

6.1.2-alpha.0

2 months ago

6.1.1

2 months ago

6.1.1-alpha.0

3 months ago

6.1.0

3 months ago

6.0.6

4 months ago

6.0.0-alpha.3

9 months ago

6.0.0-alpha.0

10 months ago

6.0.0-alpha.1

10 months ago

6.0.0-alpha.2

9 months ago

6.0.3-alpha.1

7 months ago

6.0.3-alpha.0

8 months ago

6.0.6-alpha.1

6 months ago

6.0.6-alpha.0

6 months ago

6.0.1-alpha.0

8 months ago

6.0.1

8 months ago

6.0.0

9 months ago

6.0.3

7 months ago

6.0.2

8 months ago

6.0.5

6 months ago

6.0.4

7 months ago

5.3.6

10 months ago

5.3.5

10 months ago

6.0.0-beta.3

9 months ago

6.0.0-beta.4

9 months ago

6.0.0-beta.0

9 months ago

6.0.0-beta.1

9 months ago

6.0.0-beta.2

9 months ago

6.0.2-alpha.0

8 months ago

6.0.5-alpha.0

7 months ago

6.0.5-alpha.1

7 months ago

6.0.5-alpha.2

6 months ago

5.3.5-alpha.0

11 months ago

5.3.4

11 months ago

5.3.3

11 months ago

5.3.2

12 months ago

5.3.3-alpha.0

12 months ago

5.3.3-alpha.1

11 months ago

5.3.3-alpha.2

11 months ago

5.3.3-alpha.3

11 months ago

5.3.3-alpha.4

11 months ago

5.3.3-alpha.5

11 months ago

5.1.6-alpha.0

1 year ago

5.2.4-alpha.0

1 year ago

5.2.4-alpha.1

1 year ago

5.2.4-alpha.2

1 year ago

5.2.5

1 year ago

5.2.3

1 year ago

5.2.2

1 year ago

5.2.1

1 year ago

5.3.1

1 year ago

5.3.0

1 year ago

5.1.5-alpha.0

1 year ago

5.2.5-alpha.0

1 year ago

5.1.5

1 year ago

5.1.4

1 year ago

5.2.0

1 year ago

5.2.0-alpha.0

1 year ago

5.2.0-alpha.1

1 year ago

5.2.0-alpha.2

1 year ago

5.2.0-alpha.3

1 year ago

5.1.2-alpha.0

1 year ago

5.1.2-alpha.1

1 year ago

5.1.2-alpha.3

1 year ago

5.1.3

1 year ago

5.1.2

1 year ago

5.1.1

1 year ago

5.1.0

2 years ago

5.1.4-alpha.0

1 year ago

5.0.4-alpha.0

2 years ago

5.0.5

2 years ago

5.0.4

2 years ago

5.0.3

2 years ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.3-alpha.0

2 years ago

5.0.3-alpha.3

2 years ago

5.0.3-alpha.1

2 years ago

5.0.6-alpha.0

2 years ago

5.0.6-alpha.1

2 years ago

5.0.6-alpha.2

2 years ago

5.0.2-alpha.0

2 years ago

5.0.2-alpha.1

2 years ago

5.0.2-alpha.2

2 years ago

5.0.0-alpha.2

2 years ago

5.0.0-alpha.1

2 years ago

5.0.0-alpha.0

2 years ago

5.0.0

2 years ago

5.0.1-alpha.2

2 years ago

5.0.1-alpha.1

2 years ago

5.0.1-alpha.0

2 years ago

4.5.8

2 years ago

4.5.7

2 years ago

4.5.9

2 years ago

4.5.4

2 years ago

4.5.3

2 years ago

4.5.6

2 years ago

4.5.5

2 years ago

4.5.10

2 years ago

4.5.5-alpha.0

2 years ago

4.5.5-alpha.1

2 years ago

4.5.6-alpha.0

2 years ago

4.5.6-alpha.1

2 years ago

4.5.6-alpha.6

2 years ago

4.5.6-alpha.2

2 years ago

4.5.6-alpha.3

2 years ago

4.5.6-alpha.4

2 years ago

4.5.6-alpha.5

2 years ago

4.5.9-alpha.0

2 years ago

4.5.2

2 years ago

4.4.5

2 years ago

4.4.4

2 years ago

4.5.0

2 years ago

4.5.1

2 years ago

4.4.1

2 years ago

4.4.0

2 years ago

4.4.3

2 years ago

4.4.2

2 years ago

4.5.0-alpha.0

2 years ago

4.3.2

2 years ago

4.3.4

2 years ago

4.3.3

2 years ago

4.3.2-alpha.1

2 years ago

4.3.2-alpha.0

2 years ago

4.3.3-alpha.0

2 years ago

4.4.2-alpha.0

2 years ago

4.2.2-alpha.0

2 years ago

4.2.2-alpha.1

2 years ago

4.2.2-alpha.2

2 years ago

4.3.1-alpha.0

2 years ago

4.3.1

2 years ago

4.3.0

2 years ago

4.2.2

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

4.0.3

2 years ago

4.0.2

2 years ago

3.5.1

2 years ago

3.5.0

2 years ago

4.2.1-alpha.0

2 years ago

4.2.1-alpha.1

2 years ago

3.5.1-alpha.1

2 years ago

3.5.1-alpha.0

2 years ago

3.5.1-alpha.2

2 years ago

3.4.1

2 years ago

4.1.3-alpha.0

2 years ago

4.2.1

2 years ago

4.2.0-alpha.0

2 years ago

4.2.0-alpha.2

2 years ago

4.2.0-alpha.1

2 years ago

4.1.4

2 years ago

4.1.4-alpha.0

2 years ago

4.1.0

2 years ago

4.1.2

2 years ago

4.1.1

2 years ago

3.4.0-alpha.0

2 years ago

3.4.0-alpha.1

2 years ago

3.4.0-alpha.6

2 years ago

3.4.0-alpha.7

2 years ago

3.4.0-alpha.4

2 years ago

3.4.0-alpha.5

2 years ago

3.4.0-alpha.2

2 years ago

3.4.0-alpha.3

2 years ago

3.4.0

2 years ago

3.3.3-alpha.0

2 years ago

3.3.1

2 years ago

3.3.4

2 years ago

3.3.3

2 years ago

3.3.2

2 years ago

3.2.0

3 years ago

3.0.0

3 years ago

3.1.1-alpha.0

3 years ago

3.3.0

3 years ago

3.1.0

3 years ago

3.0.0-alpha.0

3 years ago

2.1.0

3 years ago

2.0.0-alpha.6

3 years ago

1.8.2

3 years ago

2.0.0-alpha.4

3 years ago

2.0.0-alpha.5

3 years ago

2.0.0

3 years ago

1.8.3

3 years ago

2.0.0-alpha.3

3 years ago

2.0.0-alpha.2

3 years ago

1.8.1

3 years ago

1.8.0

3 years ago

1.7.8

3 years ago

1.7.7

3 years ago

2.0.0-alpha.1

3 years ago

2.0.0-alpha.0

3 years ago

1.7.6

3 years ago

1.7.5

3 years ago

1.7.4

3 years ago

1.7.3

3 years ago

1.7.2

3 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.14

3 years ago

1.5.12

3 years ago

1.5.13

3 years ago

1.5.11

3 years ago

1.5.10

3 years ago

1.5.9

3 years ago

1.5.8

3 years ago

1.5.7

3 years ago

1.5.6

3 years ago

1.5.5

3 years ago

1.5.4

3 years ago

1.5.3

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.3.4

3 years ago

1.5.0

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.8

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.2.1

3 years ago

0.1.2

3 years ago

0.1.3

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago