From 0d918a535598591324fee6473c03abf7e271af76 Mon Sep 17 00:00:00 2001 From: Nisha Yerunkar Date: Mon, 6 Nov 2023 13:30:36 -0800 Subject: [PATCH] Add component gallery descriptions (#2104) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary: A component gallery was added in #2102 without descriptions. In this PR, I added descriptions for all the listed components. I also: - added IDs to the the component headings so that the table of components scrolls to the sections correctly. - added the external link icon to indicate that all the tiles link to their respective pages in new tabs. - made the gallery more mobile-friendly Issue: https://khanacademy.atlassian.net/browse/WB-1595 ## Test plan: - Go to http://localhost:6061/?path=/docs/overview--docs - Confirm that the descriptions all make sense and are all in the same tense. Author: nishasy Reviewers: jandrade Required Reviewers: Approved By: jandrade Checks: ❌ codecov/project, ✅ Check build sizes (ubuntu-latest, 16.x), ✅ Test (ubuntu-latest, 16.x, 2/2), ✅ Lint (ubuntu-latest, 16.x), ✅ Test (ubuntu-latest, 16.x, 1/2), ✅ Publish npm snapshot (ubuntu-latest, 16.x), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 16.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 16.x), ✅ gerald, ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 16.x), ✅ Test (ubuntu-latest, 16.x, 2/2), ✅ Test (ubuntu-latest, 16.x, 1/2), ✅ Check build sizes (ubuntu-latest, 16.x), ✅ Lint (ubuntu-latest, 16.x), ✅ Chromatic - Build on regular PRs / chromatic (ubuntu-latest, 16.x), ⏭ Publish npm snapshot, ⏭ Chromatic - Skip on Release PR (changesets), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 16.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 16.x), ✅ gerald, ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 16.x), ✅ Check build sizes (ubuntu-latest, 16.x), ✅ Test (ubuntu-latest, 16.x, 2/2), ✅ Lint (ubuntu-latest, 16.x), ✅ Test (ubuntu-latest, 16.x, 1/2), ✅ Chromatic - Build on regular PRs / chromatic (ubuntu-latest, 16.x), ⏭ Chromatic - Skip on Release PR (changesets), ⏭ Publish npm snapshot, ✅ Check for .changeset entries for all changed files (ubuntu-latest, 16.x), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 16.x) Pull Request URL: https://github.com/Khan/wonder-blocks/pull/2104 --- .changeset/brown-planets-relate.md | 2 + .../components/gallery/component-tile.tsx | 35 +++- .../gallery/sections/accordion-section.tsx | 8 +- .../gallery/sections/banner-section.tsx | 10 +- .../sections/birthday-picker-section.tsx | 14 +- .../gallery/sections/breadcrumbs-section.tsx | 27 +-- .../gallery/sections/button-section.tsx | 8 +- .../gallery/sections/cell-section.tsx | 9 +- .../gallery/sections/dropdown-section.tsx | 165 ++++++++++-------- .../gallery/sections/form-section.tsx | 11 +- .../gallery/sections/icon-button-section.tsx | 3 +- .../gallery/sections/icon-section.tsx | 7 +- .../gallery/sections/link-section.tsx | 14 +- .../gallery/sections/modal-section.tsx | 6 +- .../gallery/sections/pill-section.tsx | 12 +- .../gallery/sections/popover-section.tsx | 10 +- .../sections/progress-spinner-section.tsx | 8 +- .../gallery/sections/search-field-section.tsx | 9 +- .../gallery/sections/switch-section.tsx | 10 +- .../gallery/sections/toolbar-section.tsx | 11 +- .../gallery/sections/tooltip-section.tsx | 9 +- 21 files changed, 272 insertions(+), 116 deletions(-) create mode 100644 .changeset/brown-planets-relate.md diff --git a/.changeset/brown-planets-relate.md b/.changeset/brown-planets-relate.md new file mode 100644 index 000000000..a845151cc --- /dev/null +++ b/.changeset/brown-planets-relate.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/__docs__/components/gallery/component-tile.tsx b/__docs__/components/gallery/component-tile.tsx index 9d8d44f37..d875eb244 100644 --- a/__docs__/components/gallery/component-tile.tsx +++ b/__docs__/components/gallery/component-tile.tsx @@ -1,8 +1,10 @@ import * as React from "react"; import {StyleSheet} from "aphrodite"; +import externalLinkIcon from "@phosphor-icons/core/bold/arrow-square-out-bold.svg"; import Clickable from "@khanacademy/wonder-blocks-clickable"; import {View} from "@khanacademy/wonder-blocks-core"; +import {PhosphorIcon} from "@khanacademy/wonder-blocks-icon"; import {tokens} from "@khanacademy/wonder-blocks-theming"; import {Body, HeadingMedium} from "@khanacademy/wonder-blocks-typography"; @@ -17,12 +19,24 @@ export default function ComponentTile(props: Props) { const {children, description, name, href} = props; return ( - + {() => ( <> - + {name} + + {description && ( @@ -38,6 +52,8 @@ export default function ComponentTile(props: Props) { ); } +const mobile = "@media (max-width: 1023px)"; + const styles = StyleSheet.create({ tile: { display: "flex", @@ -46,6 +62,10 @@ const styles = StyleSheet.create({ // Set the width to half the max width of the stories page content. width: 484, minHeight: 300, + + [mobile]: { + width: "95%", + }, }, clickable: { backgroundColor: tokens.color.offWhite, @@ -66,8 +86,10 @@ const styles = StyleSheet.create({ description: { padding: tokens.spacing.large_24, }, - name: { + headingContainer: { width: "fit-content", + flexDirection: "row", + alignItems: "center", }, descriptionText: { marginTop: tokens.spacing.small_12, @@ -81,5 +103,12 @@ const styles = StyleSheet.create({ borderEndStartRadius: tokens.spacing.small_12, borderEndEndRadius: tokens.spacing.small_12, flexGrow: 1, + + [mobile]: { + overflowX: "scroll", + }, + }, + externalLinkIcon: { + marginLeft: tokens.spacing.xSmall_8, }, }); diff --git a/__docs__/components/gallery/sections/accordion-section.tsx b/__docs__/components/gallery/sections/accordion-section.tsx index 1d609c999..151a15f15 100644 --- a/__docs__/components/gallery/sections/accordion-section.tsx +++ b/__docs__/components/gallery/sections/accordion-section.tsx @@ -13,7 +13,7 @@ import {styles} from "../styles"; export default function AccordionGallerySection() { return ( - + Accordion @@ -21,6 +21,9 @@ export default function AccordionGallerySection() { @@ -39,6 +42,9 @@ export default function AccordionGallerySection() { This is an accordion section. diff --git a/__docs__/components/gallery/sections/banner-section.tsx b/__docs__/components/gallery/sections/banner-section.tsx index 80ed71c4c..e6e81ca9f 100644 --- a/__docs__/components/gallery/sections/banner-section.tsx +++ b/__docs__/components/gallery/sections/banner-section.tsx @@ -9,10 +9,16 @@ import {styles} from "../styles"; export default function BannerSection() { return ( <> - + - + diff --git a/__docs__/components/gallery/sections/birthday-picker-section.tsx b/__docs__/components/gallery/sections/birthday-picker-section.tsx index 73be9eca3..b8f46a059 100644 --- a/__docs__/components/gallery/sections/birthday-picker-section.tsx +++ b/__docs__/components/gallery/sections/birthday-picker-section.tsx @@ -1,6 +1,7 @@ import * as React from "react"; import BirthdayPicker from "@khanacademy/wonder-blocks-birthday-picker"; +import {View} from "@khanacademy/wonder-blocks-core"; import {HeadingLarge} from "@khanacademy/wonder-blocks-typography"; import ComponentTile from "../component-tile"; @@ -9,14 +10,23 @@ import {styles} from "../styles"; export default function BirthdayPickerSection() { return ( <> - + Birthday Picker - {}} /> + + {}} /> + ); diff --git a/__docs__/components/gallery/sections/breadcrumbs-section.tsx b/__docs__/components/gallery/sections/breadcrumbs-section.tsx index f5fc8d387..ce85e5d49 100644 --- a/__docs__/components/gallery/sections/breadcrumbs-section.tsx +++ b/__docs__/components/gallery/sections/breadcrumbs-section.tsx @@ -4,6 +4,7 @@ import { Breadcrumbs, BreadcrumbsItem, } from "@khanacademy/wonder-blocks-breadcrumbs"; +import {View} from "@khanacademy/wonder-blocks-core"; import Link from "@khanacademy/wonder-blocks-link"; import {HeadingLarge} from "@khanacademy/wonder-blocks-typography"; @@ -13,22 +14,28 @@ import {styles} from "../styles"; export default function BannerSection() { return ( <> - + Breadcrumbs - - - Course - - - Unit - - Lesson - + + + + Course + + + Unit + + Lesson + + ); diff --git a/__docs__/components/gallery/sections/button-section.tsx b/__docs__/components/gallery/sections/button-section.tsx index 5732ae532..74851b6cc 100644 --- a/__docs__/components/gallery/sections/button-section.tsx +++ b/__docs__/components/gallery/sections/button-section.tsx @@ -11,10 +11,14 @@ import {styles} from "../styles"; export default function BannerSection() { return ( <> - + Button - +