-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start creating component gallery (sticker sheet) on Wonder Blocks ove…
…rview page
- Loading branch information
Showing
3 changed files
with
135 additions
and
0 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,61 @@ | ||
import * as React from "react"; | ||
Check warning on line 1 in .storybook/components/component-gallery.tsx GitHub Actions / Lint (ubuntu-latest, 16.x)
|
||
import {StyleSheet} from "aphrodite"; | ||
|
||
import { | ||
Accordion, | ||
AccordionSection, | ||
} from "@khanacademy/wonder-blocks-accordion"; | ||
import Banner from "@khanacademy/wonder-blocks-banner"; | ||
import BirthdayPicker from "@khanacademy/wonder-blocks-birthday-picker"; | ||
import {RenderStateRoot, View} from "@khanacademy/wonder-blocks-core"; | ||
|
||
import ComponentTile from "./component-tile"; | ||
|
||
export default function ComponentGallery() { | ||
return ( | ||
<RenderStateRoot> | ||
<View style={styles.container}> | ||
<ComponentTile | ||
name="Accordion" | ||
description={`An accordion displays a vertically | ||
stacked list of sections, each of which | ||
contains content that can be shown or hidden by | ||
clicking its header.`} | ||
href="/?path=/docs/accordion-accordion--docs" | ||
> | ||
<Accordion> | ||
<AccordionSection header="First section"> | ||
This is the information present in the first section | ||
</AccordionSection> | ||
<AccordionSection header="Second section"> | ||
This is the information present in the second | ||
section | ||
</AccordionSection> | ||
<AccordionSection header="Third section"> | ||
This is the information present in the third section | ||
</AccordionSection> | ||
</Accordion> | ||
</ComponentTile> | ||
|
||
<ComponentTile name="Banner" href="/?path=/docs/banner--docs"> | ||
<Banner text="This is a banner!" layout="floating" /> | ||
</ComponentTile> | ||
|
||
<ComponentTile | ||
name="Birthday Picker" | ||
href="/?path=/docs/birthdaypicker--docs" | ||
> | ||
<BirthdayPicker onChange={() => {}} /> | ||
</ComponentTile> | ||
</View> | ||
</RenderStateRoot> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
display: "flex", | ||
flexDirection: "row", | ||
flexWrap: "wrap", | ||
}, | ||
}); |
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,68 @@ | ||
import * as React from "react"; | ||
Check warning on line 1 in .storybook/components/component-tile.tsx GitHub Actions / Lint (ubuntu-latest, 16.x)
|
||
import {StyleSheet} from "aphrodite"; | ||
|
||
import Clickable from "@khanacademy/wonder-blocks-clickable"; | ||
import {View} from "@khanacademy/wonder-blocks-core"; | ||
import {tokens} from "@khanacademy/wonder-blocks-theming"; | ||
import {Body, HeadingMedium} from "@khanacademy/wonder-blocks-typography"; | ||
|
||
type Props = { | ||
children: React.ReactNode; | ||
name: string; | ||
description?: string; | ||
href: string; | ||
}; | ||
|
||
export default function ComponentTile(props: Props) { | ||
const {children, description, name, href} = props; | ||
return ( | ||
<Clickable href={href} target="_blank" style={styles.tile}> | ||
{() => ( | ||
<> | ||
<View style={styles.description}> | ||
<HeadingMedium tag="h3" style={styles.name}> | ||
{name} | ||
</HeadingMedium> | ||
<Body>{description}</Body> | ||
</View> | ||
<View style={styles.componentView}>{children}</View> | ||
</> | ||
)} | ||
</Clickable> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
tile: { | ||
display: "flex", | ||
flexDirection: "column", | ||
border: `1px solid ${tokens.color.offBlack16}`, | ||
borderRadius: tokens.spacing.small_12, | ||
margin: tokens.spacing.xSmall_8, | ||
// Set the width to half the max width of the stories page content. | ||
width: 484, | ||
minHeight: 300, | ||
overflow: "hidden", | ||
backgroundColor: tokens.color.offWhite, | ||
|
||
":hover": { | ||
outline: `1px solid ${tokens.color.blue}`, | ||
border: `1px solid ${tokens.color.blue}`, | ||
}, | ||
}, | ||
description: { | ||
padding: tokens.spacing.large_24, | ||
}, | ||
name: { | ||
marginBottom: tokens.spacing.small_12, | ||
}, | ||
componentView: { | ||
flexDirection: "column", | ||
justifyContent: "center", | ||
padding: tokens.spacing.large_24, | ||
borderTop: `1px solid ${tokens.color.offBlack16}`, | ||
borderRadius: tokens.spacing.small_12, | ||
backgroundColor: tokens.color.white, | ||
flexGrow: 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