-
Notifications
You must be signed in to change notification settings - Fork 0
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 #12 from acrool/10-add-storybook-skeleton-sample-l…
…otterycard2 feat: 新增 storybook lotteryCard2骨架屏
- Loading branch information
Showing
5 changed files
with
134 additions
and
2 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
example/src/components/examples/LotteryCard2/LotteryCard2Skeleton.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,37 @@ | ||
import type {Meta, StoryObj} from '@storybook/react'; | ||
import {Col, Flex, Row} from '@acrool/react-grid'; | ||
|
||
import previewImg from './preview.webp'; | ||
import LotteryCard2Skeleton from './LotteryCard2Skeleton'; | ||
|
||
const meta = { | ||
title: 'Examples/LotteryCard2', | ||
component: LotteryCard2Skeleton, | ||
parameters: { | ||
layout: 'centered', | ||
docs: { | ||
description: { | ||
component: 'Custom skeleton lottery card 2' | ||
}, | ||
}, | ||
}, | ||
tags: ['autodocs'], | ||
argTypes: {}, | ||
args: {}, | ||
} satisfies Meta<typeof LotteryCard2Skeleton>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
|
||
|
||
|
||
export const Primary: Story = { | ||
args: {}, | ||
render: function Render(args) { | ||
return <Flex className="gap-4 align-items-center"> | ||
<img src={previewImg} width="auto" height="261px" alt={''}/> | ||
<LotteryCard2Skeleton/> | ||
</Flex>; | ||
}, | ||
}; |
94 changes: 94 additions & 0 deletions
94
example/src/components/examples/LotteryCard2/LotteryCard2Skeleton.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,94 @@ | ||
import {Flex} from '@acrool/react-grid'; | ||
import styled from 'styled-components'; | ||
|
||
import {Skeleton} from '@acrool/react-skeleton'; | ||
import {generatorArray} from '@acrool/js-utils/array'; | ||
|
||
const LotteryCard2Skeleton = () => { | ||
return <LotteryCard2SkeletonRoot> | ||
|
||
<Skeleton h={20} w="85%" className="mx-auto mb-2"/> | ||
|
||
<Flex className="align-items-center"> | ||
{/* 左邊區塊 */} | ||
<Flex column className="row-gap-2"> | ||
{generatorArray(3) | ||
.map((key) => { | ||
return <Flex className="gap-2" key={key}> | ||
<Skeleton w={50} aspect={1}/> | ||
|
||
<Flex className="flex-column gap-1 my-auto"> | ||
<Skeleton w={100} r={5}/> | ||
<Flex className="flex-row gap-1 mx-auto"> | ||
{generatorArray(4) | ||
.map((key) => { | ||
return <div key={key}> | ||
<Skeleton h={25} r={3}/> | ||
</div>; | ||
})} | ||
</Flex> | ||
</Flex> | ||
|
||
<Skeleton w={50} r/> | ||
</Flex>; | ||
})} | ||
</Flex> | ||
|
||
{/* 右邊區塊 /*/} | ||
<CustomTable className="py-3"> | ||
<tr> | ||
<CustomTd/> | ||
</tr> | ||
<tr> | ||
<CustomTd2/> | ||
</tr> | ||
|
||
<FloatSkeleton h={50} w={90} className="my-auto"/> | ||
|
||
</CustomTable> | ||
</Flex> | ||
|
||
</LotteryCard2SkeletonRoot>; | ||
}; | ||
|
||
export default LotteryCard2Skeleton; | ||
|
||
|
||
|
||
|
||
|
||
const FloatSkeleton = styled(Skeleton)` | ||
position: absolute; | ||
background-color: #fff; | ||
right: 0; | ||
top: 62px; | ||
`; | ||
|
||
const CustomTable = styled.table` | ||
width: 120px; | ||
border-left: none; | ||
border-collapse: separate; | ||
position: relative; | ||
padding-right: 42px; | ||
`; | ||
|
||
const CustomTd = styled.td` | ||
border: 1px dashed rgba(133, 133, 133, 0.2); | ||
border-radius: 0 8px 0 0; | ||
border-left: none; | ||
height: 60px; | ||
`; | ||
|
||
const CustomTd2 = styled(CustomTd)` | ||
border-radius: 0 0 8px 0; | ||
border-top: none; | ||
`; | ||
|
||
const LotteryCard2SkeletonRoot = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
border-radius: 8px; | ||
background-color: #fff; | ||
border: 1px solid rgba(133, 133, 133, 0.2); | ||
padding: 15px; | ||
`; |
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 {default as LotteryCard2Skeleton} from './LotteryCard2Skeleton'; |
Binary file not shown.
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