Skip to content

Commit

Permalink
Add theme customization to README and EXAMPLES
Browse files Browse the repository at this point in the history
  • Loading branch information
vczb committed Oct 25, 2022
1 parent 21a0f76 commit d58b93c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
- [`Todo App`](https://codesandbox.io/s/sagu-ui-example-by-amit-imgw1f)
- [`Theme customization`](https://codesandbox.io/s/sagu-ui-theme-customization-2yhe9g?file=/src/App.tsx)
- [`Component customization`](https://codesandbox.io/s/sagu-ui-component-customization-wk1whk?file=/src/App.tsx)
- [`Add new object to theme`](https://codesandbox.io/s/sagu-ui-increment-colors-vxuclf?file=/src/App.tsx)
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export default App
You can easily override the values of the theme object

```js
import { theme, SaguProvider } from 'sagu-ui'

function App() {
const customTheme = Object.assign(theme)

Expand All @@ -52,6 +54,37 @@ function App() {
}
```

Also you can add an entire custom object and it will be available on the Provider

```js
import { theme, SaguProvider } from 'sagu-ui'
import { CustomWrapper } from './components/CustomWrapper'

function App() {
const customTheme = Object.assign(theme)

customTheme.colors.tertiary = {
lighter: '#fb973a',
light: '#e37c1d',
medium: '#da710f',
dark: '#9e4c01'
}

return <SaguProvider theme={customTheme}>...</SaguProvider>
}
```

```js
// components/CustomWrapper.ts
import styled, { css } from 'styled-components'

export const CustomWrapper = styled.div`
${({ theme }) => css`
background: ${theme.colors.tertiary.medium};
`}
`
```

## Component customization

You have to many ways to customize the Sagu components
Expand Down

0 comments on commit d58b93c

Please sign in to comment.