-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c4a840
commit 696bf43
Showing
14 changed files
with
184 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Meta } from '@storybook/addon-docs' | ||
|
||
import { Canvas } from 'core/storybookWrappers' | ||
|
||
import { X } from './X' | ||
|
||
<Meta title='Components/X' /> | ||
|
||
# X | ||
|
||
The most powerful component from the design system. This is the FUTURE! | ||
|
||
X component can exist as any HTML tag. | ||
|
||
Remember, it uses all the theme settings as well as other components. | ||
|
||
## Usage | ||
|
||
Try using: | ||
|
||
```tsx | ||
<X.div>something here</X.div> | ||
``` | ||
|
||
You can pass all the style props, see one example: | ||
|
||
```tsx | ||
<X.div bg='blue'>something here</X.div> | ||
``` | ||
|
||
And you can pass css events and much more: | ||
|
||
```tsx | ||
<X.div bg={{ _: 'blue', hover: 'red' }}>something here</X.div> | ||
``` | ||
|
||
See the docs for this feature [here](https://xstyled.dev/docs/hover-focus-other-states/). | ||
|
||
This example running: | ||
|
||
<Canvas> | ||
<X.div bg={{ _: 'blue', hover: 'red' }}>something here</X.div> | ||
</Canvas> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { x } from '@xstyled/styled-components' | ||
|
||
const X = x | ||
|
||
export { X } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './X' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ export * from './Divider' | |
export * from './Label' | ||
export * from './Span' | ||
export * from './A' | ||
export * from './X' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const states = { | ||
_: null, | ||
motionSafe: '@media (prefers-reduced-motion: no-preference)', | ||
motionReduce: '@media (prefers-reduced-motion: reduce)', | ||
first: '&:first-child', | ||
last: '&:last-child', | ||
odd: '&:odd', | ||
even: '&:even', | ||
visited: '&:visited', | ||
checked: '&:checked', | ||
focusWithin: '&:focus-within', | ||
hover: '&:hover', | ||
focus: '&:focus', | ||
focusVisible: '&:focus-visible', | ||
active: '&:active', | ||
disabled: '&:disabled, &[aria-disabled=true]', | ||
placeholder: '&::placeholder', | ||
} | ||
|
||
export default states |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { Meta } from '@storybook/addon-docs' | ||
|
||
import { Canvas } from 'core/storybookWrappers' | ||
|
||
import { Box } from 'components/atoms/Box' | ||
|
||
<Meta title='Docs/Styling' /> | ||
|
||
# Advanced props | ||
|
||
You can pass css events to all design system components like: | ||
|
||
```tsx | ||
<Box p='2rem' bg={{ _: 'blue', hover: 'red' }} color={{ _: 'white', hover: 'black' }}> | ||
something here | ||
</Box> | ||
``` | ||
|
||
This example running (try hover): | ||
|
||
<Canvas> | ||
<Box p='2rem' bg={{ _: 'blue', hover: 'red' }} color={{ _: 'white', hover: 'black' }}> | ||
something here | ||
</Box> | ||
</Canvas> | ||
|
||
## Using reponsive states | ||
|
||
States and breakpoints can be seemlessly mixed, every screens defined in theme are a `@media (min-width: ...)` state. | ||
|
||
```jsx preview color=fuchsia | ||
<> | ||
<template preview> | ||
<x.div textAlign='center'> | ||
<x.button | ||
type='button' | ||
py={2} | ||
px={4} | ||
bg={{ | ||
_: { _: 'indigo-500', hover: 'indigo-700' }, | ||
md: { _: 'fuchsia-500', hover: 'fuchsia-700' }, | ||
}} | ||
color='white' | ||
fontWeight='semibold' | ||
borderRadius='lg' | ||
boxShadow='md' | ||
outline={{ focus: 'none ' }} | ||
tabindex='-1' | ||
> | ||
Cameleon button | ||
</x.button> | ||
</x.div> | ||
</template> | ||
<x.button | ||
bg={{ | ||
_: { _: 'indigo-500', hover: 'indigo-700' }, | ||
md: { _: 'fuchsia-500', hover: 'fuchsia-700' }, | ||
}} | ||
> | ||
Cameleon button | ||
</x.button> | ||
</> | ||
``` | ||
|
||
## Available states | ||
|
||
Default theme includes a set of useful states. | ||
|
||
| State Prefix | CSS Scope | | ||
| -------------- | ------------------------------------------------ | | ||
| `motionSafe` | `@media (prefers-reduced-motion: no-preference)` | | ||
| `motionReduce` | `@media (prefers-reduced-motion: reduce)` | | ||
| `first` | `&:first-child` | | ||
| `last` | `&:last-child` | | ||
| `odd` | `&:odd` | | ||
| `even` | `&:even` | | ||
| `visited` | `&:visited` | | ||
| `checked` | `&:checked` | | ||
| `hover` | `&:hover` | | ||
| `focus` | `&:focus` | | ||
| `focusVisible` | `&:focus-visible` | | ||
| `focusWithin` | `&:focus-within` | | ||
| `active` | `&:active` | | ||
| `disabled` | `&:disabled, &[aria-disabled=true]` | | ||
| `placeholder` | `&::placeholder` | | ||
|
||
## Customizing states | ||
|
||
You can completely customize states in your theme: | ||
|
||
```ts | ||
export const theme = { | ||
states: { | ||
firstLetter: '&::first-letter', | ||
dark: '.xstyled-color-mode-dark &&', | ||
}, | ||
} | ||
``` | ||
|
||
See the full docs for this feature [here](https://xstyled.dev/docs/hover-focus-other-states/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters