diff --git a/showcase/src/patterns/index.js b/showcase/src/patterns/index.js index ea3bf7c..15b57d1 100644 --- a/showcase/src/patterns/index.js +++ b/showcase/src/patterns/index.js @@ -147,9 +147,22 @@ const useClapState = ({ initialState = INIT_STATE } = {}) => { [count, countTotal] ) + const togglerProps = { + onClick: handleClapClick, + 'aria-pressed': clapState.isClicked + } + + const counterProps = { + count, + 'aria-valuemax': MAX_CLAP, + 'aria-valuemin': 0, + 'aria-valuenow': count + } + return { clapState, - handleClapClick + togglerProps, + counterProps } } @@ -187,50 +200,6 @@ const useDOMRef = () => { return [DOMRef, setRef] } -/** ==================================== - * 🔰 MediumClap -==================================== **/ - -const MediumClap = () => { - const { clapState, handleClapClick } = useClapState() - const { count, countTotal, isClicked } = clapState - - const [ - { clapContainerRef, clapCountRef, countTotalRef }, - setRef - ] = useDOMRef() - - const animationTimeline = useClapAnimation({ - duration: 300, - bounceEl: clapCountRef, - fadeEl: countTotalRef, - burstEl: clapContainerRef - }) - - useEffectAfterMount( - () => { - animationTimeline.replay() - }, - [count] - ) - - return ( - - - - - - ) -} - /** ==================================== * 🔰SubComponents Smaller Component used by @@ -311,69 +280,44 @@ const CountTotal = forwardRef( may consume the component API ==================================== **/ -const CupBowl = () => { - // Credit: Created by Kieu Thi Kim Cuong from the Noun Project - return ( - - - - - - ) -} +const Usage = () => { + const { clapState, togglerProps, counterProps } = useClapState() + const { count, countTotal, isClicked } = clapState -const CupHandle = () => { - // Credit: Created by Kieu Thi Kim Cuong from the Noun Project - return ( - - - - - - ) -} + const [ + { clapContainerRef, clapCountRef, countTotalRef }, + setRef + ] = useDOMRef() -const Stream = () => { - // Credit: Created by Kieu Thi Kim Cuong from the Noun Project - return ( - - - - - + const animationTimeline = useClapAnimation({ + duration: 300, + bounceEl: clapCountRef, + fadeEl: countTotalRef, + burstEl: clapContainerRef + }) + + useEffectAfterMount( + () => { + animationTimeline.replay() + }, + [count] ) -} -const CupBase = () => { - // Credit: Created by Kieu Thi Kim Cuong from the Noun Project return ( - - - - - + + + + + ) } -const Usage = () => { - return -} - export default Usage