-
Notifications
You must be signed in to change notification settings - Fork 1
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 #5 from lobor/styled
some changes
- Loading branch information
Showing
24 changed files
with
441 additions
and
214 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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
{ | ||
"introduction": "Introduction", | ||
"installation": "Installation", | ||
"layout": { | ||
"title": "Layout" | ||
}, | ||
|
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,27 @@ | ||
import { Tabs } from 'components/Tabs'; | ||
|
||
# Installation | ||
|
||
<Tabs items={["pnpm", "npm", "yarn"]}> | ||
<Tabs.Tab> | ||
|
||
```sh | ||
pnpm i @crossed/ui | ||
``` | ||
|
||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
|
||
```sh | ||
npm i @crossed/ui | ||
``` | ||
|
||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
|
||
```sh | ||
yarn add @crossed/ui | ||
``` | ||
|
||
</Tabs.Tab> | ||
</Tabs> |
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 @@ | ||
# Introduction |
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,27 @@ | ||
import { Tabs } from 'components/Tabs'; | ||
|
||
# Installation | ||
|
||
<Tabs items={["pnpm", "npm", "yarn"]}> | ||
<Tabs.Tab> | ||
|
||
```sh | ||
pnpm i @crossed/primitive | ||
``` | ||
|
||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
|
||
```sh | ||
npm i @crossed/primitive | ||
``` | ||
|
||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
|
||
```sh | ||
yarn add @crossed/primitive | ||
``` | ||
|
||
</Tabs.Tab> | ||
</Tabs> |
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,4 +1,5 @@ | ||
{ | ||
"introduction": "Introduction", | ||
"installation": "Installation", | ||
"styled": "styled()" | ||
} |
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,6 @@ | ||
# Introduction | ||
|
||
Tailwindcss is powerfull system. | ||
Based on [twrnc](https://github.com/jaredh159/tailwind-react-native-classnames) | ||
|
||
Why create an other lib which ask to learn new theme design ? just use tailwindcss |
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,66 +1,60 @@ | ||
import { StyledDemo } from '@crossed/demo'; | ||
import { StyledDemo, StyledHtmlDemo } from '@crossed/demo'; | ||
import { CodeDemo } from 'components/CodeDemo'; | ||
import { getStaticDemo } from 'components/getStaticDemo'; | ||
import { Tabs } from 'components/Tabs'; | ||
|
||
export const getStaticProps = getStaticDemo('core/styled'); | ||
export const getStaticProps = async (e) => { | ||
return { | ||
props: { | ||
ssg: { | ||
native: (await getStaticDemo('core/styled-html'))(e).props.ssg.code, | ||
html: (await getStaticDemo('core/styled'))(e).props.ssg.code, | ||
}, | ||
}, | ||
}; | ||
}; | ||
|
||
# styled() | ||
|
||
|
||
<Tabs items={["Demo", "Anatomy", "Props"]}> | ||
<Tabs.Tab> | ||
<CodeDemo Demo={StyledDemo} /> | ||
## React web | ||
<br /> | ||
<CodeDemo Demo={StyledHtmlDemo} name="html" /> | ||
## React native | ||
<br /> | ||
<CodeDemo Demo={StyledDemo} name="native" /> | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
```typescript | ||
type ClassName = "..." | ["..."]; | ||
|
||
type Props = ComponentProps | ||
|
||
type Base<P> = { | ||
className: ClassName; | ||
props: P, | ||
} | ||
styled(Component, { | ||
'className': string[], | ||
'props': Props, | ||
":focus": Base<ComponentProps>; | ||
":hover": Base<ComponentProps>; | ||
":disabled": Base<ComponentProps>; | ||
":active": Base<ComponentProps>; | ||
'variants': { | ||
size: { | ||
xs: { | ||
'className': ClassName, | ||
'props': Props, | ||
":focus": Base<ComponentProps>; | ||
":hover": Base<ComponentProps>; | ||
":disabled": Base<ComponentProps>; | ||
":active": Base<ComponentProps>; | ||
}, | ||
}, | ||
}, | ||
'defaultVariants': { | ||
size: 'md', | ||
}, | ||
}); | ||
|
||
type State<P> = { | ||
":focus": Base<P>; | ||
":hover": Base<P>; | ||
":disabled": Base<P>; | ||
":active": Base<P>; | ||
} | ||
``` | ||
|
||
type BaseWithState<P> = State<P> & { | ||
className: ClassName; | ||
props: P, | ||
":hover": Base<P>, | ||
} | ||
|
||
styled(Component, { | ||
'className': ClassName, | ||
'props': Props, | ||
":focus": Base<ComponentProps>; | ||
":hover": Base<ComponentProps>; | ||
":disabled": Base<ComponentProps>; | ||
":active": Base<ComponentProps>; | ||
'variants': { | ||
size: { | ||
xs: { | ||
'className': ClassName, | ||
'props': Props, | ||
":focus": Base<ComponentProps>; | ||
":hover": Base<ComponentProps>; | ||
":disabled": Base<ComponentProps>; | ||
":active": Base<ComponentProps>; | ||
}, | ||
}, | ||
}, | ||
'defaultVariants': { | ||
size: 'md', | ||
}, | ||
}); | ||
``` | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
</Tabs.Tab> | ||
</Tabs> | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
</Tabs.Tab> | ||
</Tabs> |
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
Oops, something went wrong.