-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Append hashed selector to class name instead of hashing value only (#127
) Resolves #126
- Loading branch information
1 parent
ef1cbea
commit 9b9837d
Showing
11 changed files
with
191 additions
and
122 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { configure } from '@storybook/react' | ||
|
||
function loadStories() { | ||
require('../tools/story') | ||
require('../tools/box.stories') | ||
} | ||
|
||
configure(loadStories, module) |
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
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
Binary file not shown.
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,54 @@ | ||
import React from 'react' | ||
import Box, { keyframes } from '../../src' | ||
|
||
const KeyframesStory: React.FC = () => { | ||
const translateTo0 = { | ||
transform: 'translate3d(0,0,0)' | ||
} | ||
const translateNeg30 = { | ||
transform: 'translate3d(0, -30px, 0)' | ||
} | ||
|
||
const translateNeg15 = { | ||
transform: 'translate3d(0, -15px, 0)' | ||
} | ||
|
||
const translateNeg4 = { | ||
transform: 'translate3d(0,-4px,0)' | ||
} | ||
|
||
// Based on https://emotion.sh/docs/keyframes | ||
const bounce = keyframes('bounce', { | ||
from: translateTo0, | ||
20: translateTo0, | ||
40: translateNeg30, | ||
43: translateNeg30, | ||
53: translateTo0, | ||
70: translateNeg15, | ||
80: translateTo0, | ||
90: translateNeg4, | ||
to: translateTo0 | ||
}) | ||
|
||
return ( | ||
<Box> | ||
Single prop | ||
<Box animation={`${bounce} 1s ease 0s infinite normal none running`}>some bouncing text!</Box> | ||
Separate props | ||
<Box | ||
animationName={bounce} | ||
animationDuration="1s" | ||
animationTimingFunction="ease" | ||
animationDelay="0s" | ||
animationIterationCount="infinite" | ||
animationDirection="normal" | ||
animationFillMode="none" | ||
animationPlayState="running" | ||
> | ||
some bouncing text! | ||
</Box> | ||
</Box> | ||
) | ||
} | ||
|
||
export default KeyframesStory |
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,37 @@ | ||
import React, { useState } from 'react' | ||
import Box from '../../src' | ||
|
||
const SelectorUniqueness: React.FC = () => { | ||
const [isInputDisabled, setIsInputDisabled] = useState(false) | ||
|
||
return ( | ||
<Box display="flex" flexDirection="column" width={200}> | ||
Border style on hover | ||
<Box | ||
is="input" | ||
selectors={{ | ||
'&:hover': { borderColor: 'red' } | ||
}} | ||
/> | ||
Border style only when disabled | ||
<Box> | ||
Disable input | ||
<Box | ||
is="input" | ||
type="checkbox" | ||
onChange={() => setIsInputDisabled((disabled: boolean) => !disabled)} | ||
checked={isInputDisabled} | ||
/> | ||
</Box> | ||
<Box | ||
is="input" | ||
disabled={isInputDisabled} | ||
selectors={{ | ||
'&:disabled': { borderColor: 'red' } | ||
}} | ||
/> | ||
</Box> | ||
) | ||
} | ||
|
||
export default SelectorUniqueness |
Oops, something went wrong.