Skip to content

Commit

Permalink
✨ Add zIndex to theme
Browse files Browse the repository at this point in the history
  • Loading branch information
exah committed Mar 5, 2019
1 parent 0fbd276 commit b7b879f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
7 changes: 4 additions & 3 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1829,9 +1829,9 @@ const Text = styled.p`
import { zIndex } from 'pss'
```

| prop | css | type | value | true | false |
| :------- | :-------- | :---------------------------- | :---- | :--- | :---- |
| `zIndex` | `z-index` | `String`, `Number`, `Boolean` ||||
| prop | css | type | value | true | false |
| :------- | :-------- | :-------------------------------------- | :---- | :--- | :---- |
| `zIndex` | `z-index` | `String`, `Number`, `theme.zIndex[key]` ||||

Related: [position][103], [rule][179], [boolValue][182], [sizeValue][185].

Expand All @@ -1852,6 +1852,7 @@ const Box = styled.div`

```js
<Box zIndex={10} /> // position: relative; z-index: 10;
<Box zIndex='modal' /> // position: relative; z-index: 100;
```

## Atomic Styles
Expand Down
15 changes: 9 additions & 6 deletions src/styles/z-index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { createStyles, rule } from '../core'
import { createVariant } from '../core'

/**
* ```js
* import { zIndex } from 'pss'
* ```
*
* prop | css | type | value | true | false
* :----------|:----------|:------------------------------|:------|:-------|:--------
* `zIndex` | `z-index` | `String`, `Number`, `Boolean` | ✓ | — | –
* prop | css | type | value | true | false
* :----------|:----------|:----------------------------------------|:------|:-------|:--------
* `zIndex` | `z-index` | `String`, `Number`, `theme.zIndex[key]` | ✓ | — | –
*
*
* Related: {@link position}, {@link rule}, {@link boolValue}, {@link sizeValue}.
Expand All @@ -24,10 +24,13 @@ import { createStyles, rule } from '../core'
*
* @example
* <Box zIndex={10} /> // position: relative; z-index: 10;
* <Box zIndex='modal' /> // position: relative; z-index: 100;
*/

const zIndex = createStyles({
zIndex: rule('zIndex')
const zIndex = createVariant({
prop: 'zIndex',
cssProp: 'zIndex',
themeKey: 'zIndex'
})

export {
Expand Down

0 comments on commit b7b879f

Please sign in to comment.