Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding a beta of the feature, only to keep in sync what is under development until now
- Loading branch information
1 parent
ac8f295
commit d6627f5
Showing
8 changed files
with
101 additions
and
6 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 |
---|---|---|
|
@@ -70,4 +70,4 @@ export function HomeScreen() { | |
<GlobalStyle /> | ||
</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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs'; | ||
import { GridDisplay } from '@lib/components'; | ||
|
||
<Meta title="Components/GridDisplay" component={GridDisplay} /> | ||
|
||
# GridDisplay | ||
|
||
GridDisplay is the component that you use, always when you want to print a word or a phrase anywhere in your code. | ||
|
||
<!-- > [Wanna test the props? To go Storybook](https://storybook.skynexui.dev/?path=/docs/components-griddisplay--griddisplay-component) --> | ||
|
||
<ArgsTable of={GridDisplay} /> | ||
|
||
<Canvas> | ||
<Story | ||
name="GridDisplay Component" | ||
args={{ | ||
data: [1, 2, 3, 4, 5], | ||
crossAxisCount: { | ||
xs: 3, | ||
}, | ||
itemBuilder: (index, item) => { | ||
return ( | ||
<div> | ||
Current value: {item} | ||
</div> | ||
); | ||
}, | ||
}} | ||
> | ||
{(args) => <GridDisplay {...args} />} | ||
</Story> | ||
</Canvas> |
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,61 @@ | ||
import React from 'react'; | ||
import { | ||
StyleSheet, | ||
ResponsiveProperty, | ||
} from '@lib/core/stylesheet/stylesheet'; | ||
import { BoxBase } from '@lib/components/box/box-base'; | ||
|
||
interface GridDisplayProps<DataListItem> { | ||
data: DataListItem[]; | ||
crossAxisCount?: ResponsiveProperty<number>; | ||
tag?: string; | ||
className?: string; | ||
itemBuilder(index: number, item: DataListItem): React.ReactNode; | ||
styleSheet?: StyleSheet; | ||
} | ||
export function GridDisplay<DataList>({ | ||
tag, | ||
className, | ||
data, | ||
itemBuilder, | ||
styleSheet, | ||
crossAxisCount, | ||
...props | ||
}: GridDisplayProps<DataList>): JSX.Element { | ||
const finalStyleSheet = { | ||
...styleSheet, | ||
}; | ||
return ( | ||
<BoxBase | ||
as={tag} | ||
styleSheet={{ | ||
...finalStyleSheet, | ||
display: 'grid', | ||
gridTemplateColumns: { | ||
xs: crossAxisCount.xs && `repeat(${crossAxisCount.xs}, 1fr)`, | ||
sm: crossAxisCount.sm && `repeat(${crossAxisCount.sm}, 1fr)`, | ||
md: crossAxisCount.md && `repeat(${crossAxisCount.md}, 1fr)`, | ||
lg: crossAxisCount.lg && `repeat(${crossAxisCount.lg}, 1fr)`, | ||
xl: crossAxisCount.xl && `repeat(${crossAxisCount.xl}, 1fr)`, | ||
}, | ||
gridAutoRows: '1fr', | ||
}} | ||
className={`${className} sknui-griddisplay`} | ||
{...props} | ||
> | ||
{data.map((item, index) => itemBuilder(index, item))} | ||
<style jsx>{` | ||
${tag}.sknui-griddisplay { | ||
background: red; | ||
} | ||
`}</style> | ||
</BoxBase> | ||
); | ||
} | ||
|
||
GridDisplay.defaultProps = { | ||
tag: 'div', | ||
className: '', | ||
styleSheet: {}, | ||
crossAxisCount: 1, | ||
}; |
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
d6627f5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
docs-storybook – ./
docs-storybook-git-main-skynexui.vercel.app
docs-storybook.vercel.app
storybook.skynexui.dev
docs-storybook-skynexui.vercel.app
d6627f5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
sknui-demobase-react – ./examples/demo_base
sknui-demobase-react-skynexui.vercel.app
sknui-demobase-react-git-main-skynexui.vercel.app
sknui-demobase-react.vercel.app
d6627f5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
docs – ./docs
skynexui.dev
docs-skynexui.vercel.app
docs-coral-nine.vercel.app
docs-git-main-skynexui.vercel.app
www.skynexui.dev