Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typography + meta #2975

Merged
merged 56 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
e75c216
create foundations + layout stories
dreamwasp Nov 1, 2024
077dceb
Merge branch 'cass-sb-8-layout' into cass-gm-842
dreamwasp Nov 1, 2024
6537339
start foundations
dreamwasp Nov 4, 2024
03b9002
start retooling componentheader
dreamwasp Nov 4, 2024
55a5dcb
component header tweak
dreamwasp Nov 4, 2024
6d85bc3
start restructure of header components
dreamwasp Nov 4, 2024
7cee2cc
TOC + Theme working, need DataTable + code background color
dreamwasp Nov 4, 2024
2d96f2a
Merge branch 'cass-sb-8-layout' into cass-gm-842
dreamwasp Nov 4, 2024
826963c
working on color mode - need to fix text color
dreamwasp Nov 4, 2024
497d63b
Merge branch 'cass-gm-842' of ssh://github.com/Codecademy/gamut into …
dreamwasp Nov 4, 2024
7f75bca
revert test
dreamwasp Nov 5, 2024
9b69962
Theme page sorted, need to fix ColorMode
dreamwasp Nov 5, 2024
cb3c78a
colormode sorted
dreamwasp Nov 6, 2024
d85461f
colormode sorted
dreamwasp Nov 6, 2024
b1f2136
start type fix + what to do about blocks
dreamwasp Nov 6, 2024
be4e7ca
Merge branch 'cass-sb-8-layout' into cass-gm-842
dreamwasp Nov 6, 2024
7032817
LayoutGrid + content Container
dreamwasp Nov 7, 2024
2ab0c47
Merge branch 'cass-sb-8-layout' into cass-gm-842
dreamwasp Nov 7, 2024
5053d9b
Merge branch 'cass-sb-8-layout' into cass-gm-842
dreamwasp Nov 7, 2024
f20113c
Merge branch 'cass-sb-8-layout' into cass-gm-842
dreamwasp Nov 7, 2024
927e21a
Merge branch 'cass-sb-8-layout' into cass-gm-842
dreamwasp Nov 7, 2024
4abf62e
LayoutGrid done
dreamwasp Nov 7, 2024
86f15c9
Merge branch 'cass-gm-842' of ssh://github.com/Codecademy/gamut into …
dreamwasp Nov 7, 2024
02bcda0
start flexbox, need to look into sandbox stuff
dreamwasp Nov 8, 2024
2c044d5
gridbox + flexbox are good, just need to tweak
dreamwasp Nov 8, 2024
76ace8d
Merge branch 'cass-sb-8-layout', remote-tracking branch 'origin' into…
dreamwasp Nov 8, 2024
be7ec47
tweaks to headers
dreamwasp Nov 8, 2024
a77ce8e
lots of style tweaks + deduplications
dreamwasp Nov 8, 2024
b286e5a
fix typograpth, need to fix color mode switches
dreamwasp Nov 8, 2024
af5be6e
Merge branch 'cass-sb-8-layout' into cass-gm-842
dreamwasp Nov 11, 2024
a4d6db1
start on system stories
dreamwasp Nov 12, 2024
45ff066
unify shared elements
dreamwasp Nov 12, 2024
0693a32
add variance + fix tables
dreamwasp Nov 12, 2024
d98ca77
more tweaks to status
dreamwasp Nov 12, 2024
c8f9041
Merge branch 'cass-sb-8-layout' into cass-gm-842
dreamwasp Nov 12, 2024
7641220
design tweaks
dreamwasp Nov 12, 2024
2759bd2
Merge branch 'cass-gm-842' of ssh://github.com/Codecademy/gamut into …
dreamwasp Nov 12, 2024
018ffc3
add hub
dreamwasp Nov 12, 2024
2e01130
more tweaks
dreamwasp Nov 12, 2024
3b3d557
Merge branch 'cass-sb-8-layout' into cass-gm-842
dreamwasp Nov 13, 2024
dce02a1
rename DataTable
dreamwasp Nov 13, 2024
37ab760
clean up of default
dreamwasp Nov 13, 2024
5902037
typography + meta stories
dreamwasp Nov 13, 2024
ee48957
add anchor story
dreamwasp Nov 14, 2024
862fedf
start text + hiddentext
dreamwasp Nov 18, 2024
206fad4
Merge remote-tracking branch 'origin/cass-sb-8-layout' into cass-gm-843
dreamwasp Nov 18, 2024
5c59281
text done
dreamwasp Nov 18, 2024
b473bbb
started snippet changes
dreamwasp Nov 20, 2024
ffb9aa3
fixed code snippets
dreamwasp Nov 20, 2024
a9a528d
meta and sorted done?"
dreamwasp Nov 20, 2024
529822f
renamed + sorting
dreamwasp Nov 21, 2024
b7e1e79
Merge branch 'cass-sb-8-layout' into cass-gm-843
dreamwasp Nov 21, 2024
ce24811
Merge branch 'cass-sb-8-layout' into cass-gm-843
dreamwasp Nov 22, 2024
7d3bed2
more kenny edits
dreamwasp Nov 25, 2024
35bcd5b
more kenny edits + other new tab for links
dreamwasp Nov 25, 2024
2a4bf89
the last of it
dreamwasp Nov 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 111 additions & 60 deletions .vscode/stories.code-snippets
Original file line number Diff line number Diff line change
@@ -1,86 +1,137 @@
{
"Component Story": {
"prefix": "component-story",
"Component Doc": {
"prefix": "component-doc",
"body": [
"import { $1 } from '@codecademy/$2';",
"import title from '@codecademy/macros/lib/title.macro';",
"import { Canvas, Meta, Story } from '@storybook/addon-docs/blocks';",
"import { PropsTable } from '@codecademy/storybook-addon-variance';",
"import { Canvas, Controls, Meta } from '@storybook/blocks';",
"",
"import { ComponentHeader } from '~styleguide/blocks';",
"",
"import * as $1Stories from './$1.stories';",
"",
"export const parameters = {",
"subtitle: `Template component`,",
"design: {",
"type: 'figma',",
"url: 'https: //www.figma.com/file/XXX',",
" },",
"status: 'current',",
"source: {",
"repo: '$2',",
"// this is easy to find by right clicking on the file in VSCode and clicking 'Copy Remote File Url From...' and the selecting 'main' or amending the url path below like so: https://github.com/Codecademy/gamut/blob/main/packages/${2}/src/file/location",
"githubLink:",
"'https: //github.com/Codecademy/gamut/blob/main/packages/gamut/src/Logo',",
" },",
"};",
"<Meta of={$1Stories}/>",
"",
"<ComponentHeader {...parameters} />",
"",
"## Usage",
"",
"Use $1 to [what it should be used for]",
"",
"### Best practices:",
"",
"- [recommendation / best practice for implementation]",
"- [recommendation / best practice for implementation]",
"",
"When NOT to use",
"",
"- [use case]- for [describe the use case], use the [similar component] component.",
"- [use case]- for [describe the use case], use the [similar component] component",
"",
"## Anatomy",
"",
"[Insert image exported from Figma]",
"",
"1. [Element name]",
"- [description including available options and ux writing if relevant]",
"",
"<Meta",
" title={title}",
" component={$1}",
" parameters={{",
" subtitle: '$3',",
" source: '$2',",
" status: 'current' | 'updating' | 'deprecated' | 'static'$4 ,",
" design: {",
" type: 'figma',",
" url: 'https://www.figma.com/file/$5',",
" }",
" }}",
" args={{}}",
"/>",
"## Variants",
"",
"`$1` component summary goes here",
"### [Variant 1 name]",
"",
"## Design Principles",
"Use the [variant 1 name] to [what it should be used for]",
"",
"Design Principles summary",
"<Canvas of={$1Stories.Default} />",
"",
"## Usage Guidelines",
"## Playground",
"",
"Usage summary",
"If you are using a story named 'Default', you can forgo the `of` prop.",
"",
"## Code Playground",
"<Canvas sourceState='shown' of={$1Stories.Default} />",
"",
"<Canvas>",
" <Story name=\"$1\">",
" {(args) => <$1 {...args} />}",
" </Story>",
"</Canvas>",
"<Controls />",
"",
"<PropsTable story=\"$1\"/>"
"## Accessibility considerations",
"",
"- [Accessibility guidance]",
"",
"## UX writing",
"",
"- [content]",
" - [guidance]",
" - [guidance]"
],
"description": "Default Component Story Structure."
"description": "Default Component Doc Structure."
},
"Table of Contents Story": {
"prefix": "toc-story",
"body": [
"import title from '@codecademy/macros/lib/title.macro';",
"import { Meta } from '@storybook/addon-docs/blocks';",
"import { Meta } from '@storybook/blocks';",
"import { AboutHeader, TableOfContents } from '~styleguide/blocks';",
"",
"export const parameters = {",
" id: '$1',",
" title: '$1/About',",
" subtitle: '$2',",
" }",
"",
"import { TableOfContents } from '~styleguide/blocks';",
"<Meta title='$1/About' />",
"",
"<Meta",
" title={title}",
" parameters={{",
" subtitle: '$3',",
" }}",
"/>",
"<AboutHeader {...parameters} />",
"",
"<TableOfContents />"
"Foundations make up the smallest scale design values that comprise a design system. Sometimes referred to elsewhere as "tokens", they are the abstract units that comprise and stitch together our atoms, molecules, and organisms.",
"",
"<TableOfContents",
" links={[",
" {",
" id: '$1/Category',",
" subtitle: 'Short description',",
" title: 'Category',",
" }",
" ]}",
"/>"
],
"description": "TOC Story Structure."
},
"Canvas Block": {
"prefix": "canvas-block",
"body": [
"<Canvas>",
" <Story name=\"$1\" args={{}}>",
" {(args) => <$2 {...args} />}",
" </Story>",
"</Canvas>"
],
"description": "A single story block wrapped in a canvas"
},
"Story Block": {
"prefix": "story-block",
"Component Story": {
"prefix": "component-story",
"body": [
" <Story name=\"$1\" args={{}}>",
" {(args) => <$2 {...args} />}",
" </Story>"
"import { $1 } from '@codecademy/gamut';",
"import type { Meta, StoryObj } from '@storybook/react';",
"",
"const meta: Meta<typeof $1> = {",
" component: $1,",
" args: {},",
"};",
"",
"export default meta;",
"type Story = StoryObj<typeof $1>;",
"",
"export const Default: Story = {",
" args: {",
" children: 'Test'",
" },",
"};",
"",
"export const Secondary: Story = {",
" args: {",
" children: 'Test again',",
" variant: 'secondary'",
" }",
"};"
],
"description": "A single story block without a canvas"
"description": "Default TSX story structure."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
InfoTip,
Text,
} from '@codecademy/gamut';
import { Background } from '@codecademy/gamut-styles';
import { Figma } from '@storybook/addon-designs/blocks';
import { Title } from '@storybook/blocks';
import * as React from 'react';
Expand Down
11 changes: 9 additions & 2 deletions packages/styleguide/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ import { DocsContainer } from './components/Elements/DocsContainer';

const preview: Preview = {
parameters: {
backgrounds: {
disable: true,
},
docs: {
container: DocsContainer,
theme: theme,
toc: { headingSelector: 'h1, h2, h3' },
},
backgrounds: {
disable: true,
options: {
storySort: {
method: 'configure',
includeNames: true,
order: ['Meta', 'Foundations', 'Layouts', 'Typography', 'Atoms', '*'],
},
},
viewport: {
defaultViewport: 'responsive',
Expand Down
39 changes: 39 additions & 0 deletions packages/styleguide/src/lib/Meta/About.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Meta } from '@storybook/blocks';

import { AboutHeader, TableOfContents } from '~styleguide/blocks';

export const parameters = {
id: 'Meta',
title: 'Meta',
subtitle:
'Documentation and associated links explaining our in-progress approach to a design system.',
};

<Meta title="Meta/About" />

<AboutHeader {...parameters} />

<TableOfContents
links={[
{
id: 'Meta/BestPractices',
subtitle: 'Current best practices for using the Gamut Design System',
title: 'Best Practices',
},
{
id: 'Meta/Contributing',
subtitle: `Thanks so much for being interested in contributing to Gamut! We love working with Codecademy employees across all our teams.`,
title: 'Contributing',
},
{
id: 'Meta/FAQ',
dreamwasp marked this conversation as resolved.
Show resolved Hide resolved
subtitle: `Please let us know if there are questions you'd like answered here!`,
title: 'FAQ',
},
{
id: 'Meta/Stories',
subtitle: `We're still building these opinions out, so don't expect all stories to adhere just yet!`,
title: 'Stories',
},
]}
/>
16 changes: 16 additions & 0 deletions packages/styleguide/src/lib/Meta/Brand.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Meta } from '@storybook/blocks';

import { AboutHeader } from '~styleguide/blocks';

export const parameters = {
id: 'Brand',
title: 'Brand',
subtitle: `Codecademy internal and branded components`,
status: 'static',
};

<Meta title="Meta/Brand" />

<AboutHeader {...parameters} />

The [Brand Library](https://brand-storybook.codecademy.com/) is a subset of assets, components, and themes intended for branded experiences and internal use. If you have any questions about Brand, feel free to reach out at #gamut-team on Slack.
93 changes: 93 additions & 0 deletions packages/styleguide/src/lib/Meta/Contributing.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import { Meta } from '@storybook/blocks';

import { AboutHeader, LinkTo } from '~styleguide/blocks';

export const parameters = {
id: 'Contributing',
title: 'Contributing',
subtitle: `Thanks so much for being interested in contributing to Gamut!
We love working with Codecademy employees across all our teams.`,
status: 'static',
};

<Meta title="Meta/Contributing" />

<AboutHeader {...parameters} />

## Prework

We track planned work for Gamut components in the [Gamut Board](https://codecademy.atlassian.net/jira/software/projects/WEB/boards/1386) on JIRA.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good callout!


- If there's a ticket there you want to take on, send a Slack to #gamut-team or come to Gamut Office hours and lets talk about it!
- If the work you'd like to do isn't captured in a JIRA ticket, talk to us and we can work with you to create that ticket.
- If you would like to make a request for work to be done, please discuss with us on Slack or during Gamut Office Hours.
- If you'd like to pitch a change to the design system, please attend Gamut Crit, come to Gamut Office Hours, or send a Slack message to #gamut-team.

## Writing components

### Component structure

Create your component as an `index.tsx` file in a PascalCase-named folder within its package directory, such as `packages/gamut/src/ProgressBar/index.tsx`.
Consider saving this recommended format as an editor snippet:

```tsx
import React from 'react';

export type MyComponentProps = {
/* ... */
};

export const MyComponent: React.FC<MyComponentProps> = (
{
/* ... */
}
) => {
// ...
};
```

#### Props documentation

With the exception of widespread, self-documenting props such as `onClick`, please include a sentence cased description of the prop's intent.
React props on the component will be picked up by Storybook and added to the component's documentation story.
We prefer these be full sentences.

```ts
/**
* Number of lines to limit the message to.
*/
limit: number;
```

- If your comment purely restartes the name and type of variable, please either elaborate on it or remove the comment altogether.
- Consider starting comments for booleans with _"Whether "_.

### Unit tests

Your component should have unit tests in a `__tests__/MyComponent-test.tsx` file within its directory.
Use Enzyme's `mount` to test it.

We generally try to unit test all component logic, with the exception of class names in components that contain other logic.

### Stories

All components must have Storybook stories showing their use. See <LinkTo id='Meta/Stories'>Stories</LinkTo> for documentation.

## Pull requests

Please fill out the pull request template, including links to the corresponding Abstract design and JIRA ticket.

> 😉 Protip: You can use a [Draft PR](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests#draft-pull-requests) to still run CI jobs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing as theses tips popup from time to time, it'd be nice to standardize them :)

> That includes deploying a Netlify preview and publishing alpha package versions to npm.

### Publishing updates

If you know your PR has breaking changes in at least one downstream repository:
dreamwasp marked this conversation as resolved.
Show resolved Hide resolved

1. Before merging it, create PRs in those downstream repositories using your PR's published alpha package versions
2. Verify those PRs work as expected and get them signed off normally
3. Merge your Gamut PR
4. Wait until the new Gamut package is published, then update the downstream repository PRs to use it
5. Merge and deploy those PRs as soon as possible

If your PR contains breaking changes that might affect other users, please mention them in the `#frontend` Slack channel.
Loading