-
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.
- Loading branch information
Lionel Bertrand
committed
Aug 24, 2023
1 parent
6055686
commit 9642ba0
Showing
53 changed files
with
546 additions
and
675 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
{ | ||
"introduction": { | ||
"title": "Intoduction" | ||
}, | ||
"createButton": { | ||
"title": "createButton" | ||
} | ||
} |
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 { CreateButtonWithContextDemo, CreateButtonDemo } from '@crossed/demo'; | ||
import { CodeDemo } from 'components/CodeDemo'; | ||
import { getStaticDemo } from 'components/getStaticDemo'; | ||
import { Tabs } from 'components/Tabs'; | ||
import { Table } from 'components/Table'; | ||
|
||
export const getStaticProps = async (e) => { | ||
const [ | ||
{ | ||
props: { | ||
ssg: { code: codeSimple }, | ||
}, | ||
}, | ||
{ | ||
props: { | ||
ssg: { code: codeWithContext }, | ||
}, | ||
}, | ||
] = await Promise.all([ | ||
getStaticDemo('primitive/createButton/simple')(e), | ||
getStaticDemo('primitive/createButton/withContext')(e), | ||
]); | ||
|
||
return { | ||
props: { | ||
ssg: { codeSimple, codeWithContext }, | ||
}, | ||
}; | ||
}; | ||
|
||
# createButton | ||
|
||
<Tabs items={['Demo', 'Anatomy', 'Props']}> | ||
<Tabs.Tab> | ||
## simple | ||
<CodeDemo Demo={CreateButtonDemo} name="codeSimple" /> | ||
## With context | ||
<CodeDemo Demo={CreateButtonWithContextDemo} name="codeWithContext" /> | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
```tsx | ||
<Menu> | ||
<Menu.Item> | ||
<Menu.Item.Title /> | ||
<Menu.Item.Subtitle /> | ||
</Menu.Item> | ||
</Menu> | ||
``` | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
## Menu | ||
<Table props={[]} /> | ||
</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 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,3 +1,4 @@ | ||
export * from './core/styled'; | ||
export * from './ui'; | ||
export * from './unicons'; | ||
export * from './primitive'; |
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,2 @@ | ||
export * from './simple'; | ||
export * from './withContext'; |
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,24 @@ | ||
import { createButton } from '@crossed/primitive'; | ||
import { Box } from '@crossed/ui'; | ||
|
||
const Button = createButton({ | ||
Root: (props) => { | ||
return <button className="bg-blue-500" {...props} />; | ||
}, | ||
Text: ({ title }: { title: string }) => { | ||
return <span className="text-white">{title}</span>; | ||
}, | ||
Icon: () => { | ||
return <span>€</span>; | ||
}, | ||
}); | ||
|
||
export const CreateButtonDemo = () => { | ||
return ( | ||
<Box> | ||
<Button> | ||
<Button.Text title="text button" /> | ||
</Button> | ||
</Box> | ||
); | ||
}; |
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,32 @@ | ||
import { createButton, useButtonContext } from '@crossed/primitive'; | ||
import { Box } from '@crossed/ui'; | ||
|
||
const Button = createButton( | ||
{ | ||
Root: (props) => { | ||
return <button className="bg-blue-500" {...props} />; | ||
}, | ||
Text: () => { | ||
// const { title } = useButtonContext(); | ||
return <span className="text-white">{"title"}</span>; | ||
}, | ||
Icon: () => { | ||
return <span>€</span>; | ||
}, | ||
}, | ||
{ | ||
context: { | ||
title: 'Hello World!', | ||
}, | ||
} | ||
); | ||
|
||
export const CreateButtonWithContextDemo = () => { | ||
return ( | ||
<Box> | ||
<Button> | ||
<Button.Text title="text button" /> | ||
</Button> | ||
</Box> | ||
); | ||
}; |
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 @@ | ||
export * from './createButton'; |
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,28 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
node_modules | ||
.pnp | ||
.pnp.js | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# build | ||
dist | ||
lib | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# turbo | ||
.turbo |
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,42 @@ | ||
{ | ||
"name": "@crossed/primitive", | ||
"description": "A universal & performant styling library for React Native, Next.js & React", | ||
"version": "1.0.0", | ||
"main": "lib/commonjs/index", | ||
"types": "lib/typescript/index.d.ts", | ||
"module": "lib/module/index", | ||
"react-native": "src/index", | ||
"source": "src/index", | ||
"typings": "lib/typescript/index.d.ts", | ||
"scripts": { | ||
"release": "release-it", | ||
"clean": "rm -rf lib", | ||
"watch": "crossed-build --watch", | ||
"build": "crossed-build", | ||
"dev:web": "cd example/native && yarn web --clear" | ||
}, | ||
"devDependencies": { | ||
"@crossed/build": "*", | ||
"@types/react": "^18.2.20", | ||
"@types/react-native": "^0.72.2", | ||
"babel-plugin-transform-remove-console": "^6.9.4", | ||
"jest": "^29.5.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-native": "^0.72.3", | ||
"react-native-web": "^0.19.7", | ||
"tsconfig": "*" | ||
}, | ||
"dependencies": { | ||
"@crossed/core": "*", | ||
"@floating-ui/react": "^0.25.1", | ||
"@gorhom/portal": "^1.0.14", | ||
"@react-native-aria/focus": "^0.2.8", | ||
"@react-native-aria/interactions": "^0.2.10", | ||
"react-aria": "^3.27.0" | ||
}, | ||
"files": [ | ||
"lib/", | ||
"src/" | ||
] | ||
} |
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,8 @@ | ||
import { forwardRef } from 'react'; | ||
import { useContext } from './context'; | ||
|
||
export const createButtonMain = <T,>(StyledButton: React.ComponentType<T>) => | ||
forwardRef<any, T>((props, ref) => { | ||
const context = useContext(); | ||
return <StyledButton {...context} {...props} ref={ref} />; | ||
}); |
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,8 @@ | ||
import { ComponentType, forwardRef } from 'react'; | ||
import { useContext } from './context'; | ||
|
||
export const createButtonIcon = <T,>(StyledIcon: ComponentType<T>) => | ||
forwardRef<any, T>((props, ref) => { | ||
const context = useContext(); | ||
return <StyledIcon {...context} {...props} ref={ref} />; | ||
}); |
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,8 @@ | ||
import { ComponentType, forwardRef } from 'react'; | ||
import { useContext } from './context'; | ||
|
||
export const createButtonText = <T,>(StyledText: ComponentType<T>) => | ||
forwardRef<any, T>((props, ref) => { | ||
const context = useContext(); | ||
return <StyledText {...context} {...props} ref={ref} />; | ||
}); |
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,3 @@ | ||
import { createScope } from '@crossed/core'; | ||
|
||
export const [Provider, useContext] = createScope<any>({}); |
Oops, something went wrong.