-
Notifications
You must be signed in to change notification settings - Fork 812
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(flat-components): add skeletons component to cloud storage (#985)
- Loading branch information
Showing
5 changed files
with
103 additions
and
2 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...nents/src/components/CloudStorage/CloudStorageSkeletons/CloudStorageSkeletons.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,18 @@ | ||
import React from "react"; | ||
import { Meta, Story } from "@storybook/react"; | ||
import { CloudStorageSkeletons, CloudStorageSkeletonsProps } from "."; | ||
|
||
const storyMeta: Meta = { | ||
title: "CloudStorage/CloudStorageSkeletons", | ||
component: CloudStorageSkeletons, | ||
}; | ||
|
||
export default storyMeta; | ||
|
||
export const Overview: Story<CloudStorageSkeletonsProps> = args => ( | ||
<CloudStorageSkeletons {...args} /> | ||
); | ||
|
||
Overview.args = { | ||
filesCount: 10, | ||
}; |
34 changes: 34 additions & 0 deletions
34
packages/flat-components/src/components/CloudStorage/CloudStorageSkeletons/index.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,34 @@ | ||
import "./style.less"; | ||
|
||
import React from "react"; | ||
import { Skeleton } from "antd"; | ||
import classNames from "classnames"; | ||
|
||
export interface CloudStorageSkeletonsProps { | ||
isCompactMode: boolean; | ||
} | ||
|
||
export const CloudStorageSkeletons: React.FC<CloudStorageSkeletonsProps> = ({ isCompactMode }) => { | ||
return ( | ||
<div className="cloud-storage-skeletons"> | ||
{Array(10) | ||
.fill(0) | ||
.map((_, i) => ( | ||
<div className="cloud-storage-skeletons-item" key={i}> | ||
<div | ||
className={classNames("cloud-storage-skeletons-item-icon", { | ||
"cloud-storage-skeletons-item-icon-compact": isCompactMode, | ||
})} | ||
> | ||
<Skeleton active title={false} paragraph={{ rows: 1, width: "100%" }} /> | ||
</div> | ||
<div className="cloud-storage-skeletons-item-file"> | ||
<Skeleton active title={false} paragraph={{ rows: 1, width: "100%" }} /> | ||
</div> | ||
<Skeleton active title={false} paragraph={{ rows: 1, width: "88%" }} /> | ||
<Skeleton active title={false} paragraph={{ rows: 1, width: "100%" }} /> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; |
44 changes: 44 additions & 0 deletions
44
packages/flat-components/src/components/CloudStorage/CloudStorageSkeletons/style.less
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,44 @@ | ||
.cloud-storage-skeletons { | ||
padding: 0 16px; | ||
|
||
> * { | ||
padding-top: 16px; | ||
border-bottom: 1px solid #dbe1ea; | ||
|
||
&:last-of-type { | ||
border-bottom: none; | ||
} | ||
} | ||
|
||
.ant-skeleton.ant-skeleton-active .ant-skeleton-content .ant-skeleton-title, | ||
.ant-skeleton.ant-skeleton-active .ant-skeleton-content .ant-skeleton-paragraph > li { | ||
background: linear-gradient( | ||
90deg, | ||
hsla(210, 33%, 96%, 1) 25%, | ||
hsla(210, 33%, 92%, 1) 37%, | ||
hsla(210, 33%, 96%, 1) 63% | ||
); | ||
background-size: 400% 100%; | ||
animation: ant-skeleton-loading 1.4s ease infinite; | ||
} | ||
} | ||
|
||
.cloud-storage-skeletons-item { | ||
display: flex; | ||
flex-direction: row; | ||
} | ||
|
||
.cloud-storage-skeletons-item-icon { | ||
width: 8%; | ||
margin-right: 20px; | ||
} | ||
|
||
.cloud-storage-skeletons-item-icon-compact { | ||
width: 18%; | ||
margin-right: 20px; | ||
} | ||
|
||
.cloud-storage-skeletons-item-file { | ||
width: 100%; | ||
margin-right: 200px; | ||
} |
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 @@ | ||
export * from "./CloudStorageFileList"; | ||
export * from "./CloudStorageUploadItem"; | ||
export * from "./CloudStorageUploadPanel"; | ||
export * from "./CloudStorageSkeletons"; | ||
export * from "./types"; |
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