Skip to content

Commit

Permalink
add wrappers & layout divs migration guide
Browse files Browse the repository at this point in the history
  • Loading branch information
pettinarip committed Aug 17, 2022
1 parent 1d15d8e commit d9095e0
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions docs/chakra-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,63 @@ This is part of our [UI library implementation epic](https://github.com/ethereum

All `styled` components need to be removed and replaced with the corresponded Chakra component. [See the list of components](https://chakra-ui.com/docs/components).

Use as much native Chakra components as possible.

### Wrappers or layout divs

Use the [native layouts components](https://chakra-ui.com/docs/components/box)

```tsx
// before
const Wrapper = styled.div`
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
`

// now
<Stack direction='row'>
```

Center things using the `<Center />` component

```tsx
// before
const Center = styled.div`
height: 100px;
display: flex;
justify-content: center;
align-items: center;
`

// now
<Center h="100px">
```

Group buttons using `<ButtonGroup />` or `<Wrap />`

```tsx
// before
const ButtonRow = styled.div`
display: flex;
align-items: center;
flex-wrap: wrap;
`

// now
<ButtonGroup variant='outline' spacing={2}>
<Button>Button 1</Button>
<Button>Button 2</Button>
</ButtonGroup>

// or
<Wrap spacing={2}>
<WrapItem><Button variant="outline">Button 1</Button></WrapItem>
<WrapItem><Button variant="outline">Button 2</Button></WrapItem>
</Wrap>
```

## Override styles using style props

- You can see how to use the different style props here: [https://chakra-ui.com/docs/styled-system/style-props](https://chakra-ui.com/docs/styled-system/style-props#margin-and-padding)
Expand Down

0 comments on commit d9095e0

Please sign in to comment.