This repository has been archived by the owner on Dec 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from gluestack/release/@dank-style/[email protected]
Release/@dank style/[email protected]
- Loading branch information
Showing
7 changed files
with
196 additions
and
11 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
169 changes: 169 additions & 0 deletions
169
example/storybook/src/api/CompoundVariants/CompoundVariants.tsx
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,169 @@ | ||
import React, { memo, useEffect, useState } from 'react'; | ||
import { AnimationResolver } from '@dank-style/animation-plugin'; | ||
|
||
import { createStyled, styled } from '@dank-style/react'; | ||
import { Wrapper } from '../../components/Wrapper'; | ||
import { Motion } from '@legendapp/motion'; | ||
import { View } from 'react-native'; | ||
import { Text } from 'react-native'; | ||
|
||
const StyledView = styled( | ||
View, | ||
{ | ||
h: 20, | ||
w: 20, | ||
bg: '$red800', | ||
|
||
props: { | ||
variant: 'solid', | ||
size: 'md', | ||
// bg: '$red500', | ||
}, | ||
|
||
// props: { | ||
// variant: 'sm', | ||
// // bg: '$blue400', | ||
// }, | ||
|
||
// ':hover': { | ||
// props: { | ||
// variant: 'sm', | ||
// // bg: '$blue400', | ||
// }, | ||
// }, | ||
// size: 20, | ||
// color: '$red300', | ||
variants: { | ||
variant: { | ||
solid: { | ||
bg: '$amber200', | ||
_dark: { | ||
bg: '$pink400', | ||
}, | ||
}, | ||
}, | ||
size: { | ||
md: { | ||
padding: '$10', | ||
}, | ||
}, | ||
}, | ||
|
||
compoundVariants: [ | ||
{ | ||
variant: 'solid', | ||
size: 'md', | ||
value: { | ||
bg: '$red400', | ||
_dark: { | ||
bg: '$blue600', | ||
}, | ||
}, | ||
}, | ||
], | ||
|
||
// _dark: { | ||
// // color: '$muted50', | ||
// h: 16, | ||
// w: 16, | ||
// }, | ||
}, | ||
{ | ||
ancestorStyle: ['_icon'], | ||
// resolveProps: ['size'], | ||
DEBUG: 'STYLED_ICON', | ||
}, | ||
{ | ||
// alias: { | ||
// size: 'space', | ||
// }, | ||
// propertyTokenMap: { | ||
// size: 'space', | ||
// }, | ||
// propertyResolver: { | ||
// size: (rawValue: any, resolver: any) => { | ||
// console.log('hello size', rawValue); | ||
// return resolver(rawValue); | ||
// }, | ||
// }, | ||
} | ||
); | ||
export function CompoundVariants() { | ||
const [hover, setHover] = useState(false); | ||
|
||
// console.log( | ||
// animatedPlugin.inputMiddleWare({ | ||
// ':animate': { | ||
// opacity: 0.5, | ||
// y: 0, | ||
// }, | ||
// ':initial': { | ||
// y: -50, | ||
// }, | ||
// ':hover': { | ||
// ':animate': { | ||
// opacity: 1, | ||
// }, | ||
// }, | ||
// }), | ||
// '%%%%%%%%%%%' | ||
// ); | ||
|
||
const ref = React.useRef(null); | ||
|
||
useEffect(() => { | ||
if (ref && ref.current) { | ||
ref.current.addEventListener('mouseover', () => { | ||
setHover(true); | ||
}); | ||
ref.current.addEventListener('mouseout', () => { | ||
setHover(false); | ||
}); | ||
} | ||
setTimeout(() => { | ||
setHover(true); | ||
}, 5000); | ||
}, []); | ||
|
||
return ( | ||
<Wrapper> | ||
<StyledView | ||
// sx={{ | ||
// ':hover': { | ||
// props: { | ||
// variant: 'sm', | ||
// // bg: '$blue400', | ||
// }, | ||
// }, | ||
// }} | ||
// variant="sm" | ||
// bg="$blue400" | ||
// variant="sm" | ||
// animate="hello" | ||
// states={{ hover: true }} | ||
// sx={{ | ||
// props: { | ||
// variant: 'sm', | ||
// bg: '$red400', | ||
// }, | ||
// }} | ||
> | ||
<Text>Hello</Text> | ||
</StyledView> | ||
{/* <StyledMotionView | ||
ref={ref} | ||
variant="subtle" | ||
animate={{ | ||
x: value * 100, | ||
opacity: value ? 1 : 0.2, | ||
scale: value ? 1 : 0.5, | ||
}} | ||
states={{ hover: hover }} | ||
> | ||
<StlyedText>Hello World</StlyedText> | ||
</StyledMotionView> */} | ||
</Wrapper> | ||
); | ||
} | ||
|
||
export default CompoundVariants; |
9 changes: 9 additions & 0 deletions
9
example/storybook/src/api/CompoundVariants/CompoundVarinats.stories.tsx
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,9 @@ | ||
import type { ComponentMeta } from '@storybook/react-native'; | ||
import { CompoundVariants } from './CompoundVariants'; | ||
const MyCompoundVariantsMeta: ComponentMeta<typeof CompoundVariants> = { | ||
title: 'api/stories/CompoundVariants', | ||
component: CompoundVariants, | ||
}; | ||
|
||
export { CompoundVariants } from './CompoundVariants'; | ||
export default MyCompoundVariantsMeta; |
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