0.35.3 • Published 8 days ago

@amsterdam/asc-ui v0.35.3

Weekly downloads
1,176
License
MPL-2.0
Repository
github
Last release
8 days ago

Amsterdam Styled Components UI

This is the React implementation of the styled-components

Installation

Add this package to your project by running:

npm install @amsterdam/asc-ui

Usage

Consult the demo site with the storybook of the components to see the available components and examples

Basic tweak of an existing style

import styled from 'styled-components'
import { themeColor, List, breakpoint, styles, ThemeProvider } from '@amsterdam/asc-ui'

const StyledList = styled(List)`
  background-color: ${themeColor('tint', 'level5')};

  @media screen and ${breakpoint('min-width', 'laptopM')} {
    background-color: ${themeColor('tint', 'level1')};
  }

  ${styles.ListItemStyle} {
    color: ${themeColor('primary')};
  }

  `

<ThemeProvider>
  <StyledList>
    <ListItem href="/">Item1</ListItem>
    <ListItem href="/">Item2</ListItem>
  </StyledList>
</ThemeProvider>

The background color of the StyledList component has the color of tint.level5 widths smaller than laptopM breakpoint and tint.level1 for widths larger than laptopM The colors and the breakpoints are defined in the default theme

Each component exposes its style that can be used a (class)selector in another component. The naming convention for the styles is: <component-name> -> styles.<component-name>Style. For example ListItem has a styles.ListStyle selector. We use the exposed selector to change the color of the LinkedListItems to the primary theme color. In this case we don't need to create a new StyledLinkedList item to override the style. This is just the way we are exposing the styles from the asc library to be used as selectors. For extending the styles use the convention const StyledLinkList = styled(LinkList) as shown in the example.

The same can be achieved by creating of a new StyledLinkedListItem:

import styled from 'styled-components'
import { themeColor, List, breakpoint, styles, ThemeProvider, svgFill } from '@amsterdam/asc-ui'

const StyledList = styled(List)`
  background-color: ${themeColor('tint', 'level5')};

  @media screen and ${breakpoint('min-width', 'laptopM')} {
    background-color: ${themeColor('tint', 'level1')};
  }
`

const StyledListItem - styled(ListItem)`
  color: ${themeColor('primary')};

  ${styles.IconStyle} {
    ${svgFill(themeColor('tint', 'level1'))};
  }

  ${styles.LinkStyle} {

    &:hover {
      ${IconStyle} {
        ${svgFill(themeColor('primary', 'main'))};
      }
    }
  }

`

<ThemeProvider>
  <StyledList>
    <StyledListItem href="/">Item1</StyledListItem>
    <StyledListItem href="/">Item2</StyledListItem>
  </StyledList>
</ThemeProvider>

In this example, we use the IconStyle selector to override the color of the chevron icon from the ListItem

1.0.0-alpha.0

8 days ago

0.35.3

8 days ago

1.0.0-beta.0

8 days ago

0.35.1-alpha.31

4 months ago

0.35.2

4 months ago

0.35.1

5 months ago

0.34.0

7 months ago

0.35.0

6 months ago

0.33.1-alpha.45

7 months ago

0.34.1-alpha.0

6 months ago

0.33.1-alpha.21

7 months ago

0.33.0

8 months ago

0.32.2-alpha.1

8 months ago

0.32.1

9 months ago

0.32.1-alpha.0

9 months ago

0.32.2-alpha.0

9 months ago

0.32.0

9 months ago

0.31.1-alpha.20

10 months ago

0.30.1-alpha.29

11 months ago

0.30.1-alpha.28

11 months ago

0.31.0

11 months ago

0.30.1-alpha.22

11 months ago

0.30.1-alpha.21

11 months ago

0.30.1-alpha.20

11 months ago

0.30.1-alpha.1

11 months ago

0.30.1-alpha.0

11 months ago

0.29.4-alpha.55

12 months ago

0.30.0

12 months ago

0.29.4-alpha.54

12 months ago

0.29.4-alpha.49

12 months ago

0.29.4-alpha.44

12 months ago

0.29.4-alpha.43

12 months ago

0.29.4-alpha.17

1 year ago

0.29.4-alpha.18

1 year ago

0.29.4-alpha.15

1 year ago

0.29.4-alpha.29

1 year ago

0.29.4-alpha.20

1 year ago

0.29.4-alpha.21

1 year ago

0.29.4-alpha.30

1 year ago

0.29.3-alpha.43

1 year ago

0.29.4-alpha.7

1 year ago

0.29.4-alpha.1

1 year ago

0.29.3

1 year ago

0.29.3-alpha.27

1 year ago

0.29.3-alpha.26

1 year ago

0.29.3-alpha.22

1 year ago

0.29.3-alpha.23

1 year ago

0.29.3-alpha.10

1 year ago

0.29.1-alpha.1

1 year ago

0.29.2-alpha.0

1 year ago

0.29.0

1 year ago

0.29.2

1 year ago

0.29.1

1 year ago

0.27.1-alpha.88

1 year ago

0.27.1-alpha.86

1 year ago

0.27.1-alpha.79

1 year ago

0.27.1-alpha.77

1 year ago

0.27.1-alpha.70

1 year ago

0.27.1-alpha.58

1 year ago

0.27.1-alpha.60

1 year ago

0.28.0

1 year ago

0.27.1-alpha.0

1 year ago

0.27.0

1 year ago

0.26.2

1 year ago

0.26.3-alpha.0

1 year ago

0.26.2-alpha.0

1 year ago

0.26.2-alpha.73

1 year ago

0.26.2-alpha.72

1 year ago

0.26.2-alpha.46

2 years ago

0.26.2-alpha.45

2 years ago

0.26.2-alpha.36

2 years ago

0.26.1

2 years ago

0.26.1-alpha.11

2 years ago

0.26.0

2 years ago

0.25.3-alpha.94

2 years ago

0.25.3-alpha.92

2 years ago

0.25.3-alpha.93

2 years ago

0.25.3-alpha.90

2 years ago

0.25.3-alpha.91

2 years ago

0.25.3-alpha.86

2 years ago

0.25.3-alpha.74

2 years ago

0.25.2

2 years ago

0.25.2-alpha.10

2 years ago

0.25.2-alpha.14

2 years ago

0.25.1

2 years ago

0.25.1-alpha.3

2 years ago

0.25.0

2 years ago

0.24.5-alpha.5

2 years ago