-
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 #58 from Project-Betoniera/feat/skeletons
Feat/skeletons
- Loading branch information
Showing
6 changed files
with
250 additions
and
113 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Card, Skeleton, SkeletonItem, makeStyles } from "@fluentui/react-components"; | ||
import { FunctionComponent } from "react"; | ||
import { useGlobalStyles } from "../../globalStyles"; | ||
|
||
type ClassroomDetailsSkeletonProps = { | ||
lines?: number; | ||
}; | ||
|
||
const useStyles = makeStyles({ | ||
skeletonRoot: { | ||
display: "flex", | ||
flexDirection: "column", | ||
rowGap: "0.8rem" | ||
}, | ||
skeletonBody: { | ||
display: "flex", | ||
flexDirection: "column", | ||
rowGap: "0.5rem" | ||
} | ||
}); | ||
|
||
const ClassroomDetailsSkeleton: FunctionComponent<ClassroomDetailsSkeletonProps> = (props) => { | ||
const styles = useStyles(); | ||
const globalStyles = useGlobalStyles(); | ||
|
||
return ( | ||
<Card className={globalStyles.card}> | ||
<Skeleton> | ||
<div className={styles.skeletonRoot}> | ||
<SkeletonItem size={24} /> | ||
<div className={styles.skeletonBody}> | ||
{new Array(props.lines || 1).fill(null).map((_, index) => <SkeletonItem key={index} size={16} />)} | ||
</div> | ||
</div> | ||
</Skeleton> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default ClassroomDetailsSkeleton; |
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,51 @@ | ||
import { FunctionComponent } from "react"; | ||
import { useGlobalStyles } from "../../globalStyles"; | ||
import { Card, Skeleton, SkeletonItem, makeStyles, } from "@fluentui/react-components"; | ||
|
||
export type EventDetailsSkeletonProps = { | ||
lines?: number, | ||
as?: "card"; | ||
}; | ||
|
||
const useSkeletonStyles = makeStyles({ | ||
root: { | ||
display: "flex", | ||
flexDirection: "column", | ||
rowGap: "0.8rem" | ||
}, | ||
body: { | ||
display: "flex", | ||
flexDirection: "column", | ||
rowGap: "0.5rem" | ||
} | ||
}); | ||
|
||
/** | ||
* A skeleton component used to display a loading state of the EventDetails component. | ||
* @param props the properties of the component. | ||
*/ | ||
const EventDetailsSkeleton: FunctionComponent<EventDetailsSkeletonProps> = (props: EventDetailsSkeletonProps) => { | ||
const styles = useSkeletonStyles(); | ||
const globalStyles = useGlobalStyles(); | ||
|
||
const content = ( | ||
<div className={styles.root}> | ||
<SkeletonItem size={24} /> | ||
<div className={styles.body}> | ||
{new Array(props.lines || 1).fill(null).map((_, index) => <SkeletonItem key={index} size={16} />)} | ||
</div> | ||
</div> | ||
); | ||
|
||
return props.as === "card" ? ( | ||
<Card className={globalStyles.card}> | ||
<Skeleton> | ||
{content} | ||
</Skeleton> | ||
</Card> | ||
) : ( | ||
content | ||
); | ||
}; | ||
|
||
export default EventDetailsSkeleton; |
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
Oops, something went wrong.