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

create foundations + layout stories #2966

Merged
merged 43 commits into from
Nov 18, 2024
Merged
Changes from 1 commit
Commits
Show all changes
43 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
4e1b4c1
fix kenny tweaks!
dreamwasp Nov 18, 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
Prev Previous commit
Next Next commit
TOC + Theme working, need DataTable + code background color
dreamwasp committed Nov 4, 2024
commit 7cee2ccfc33ebc7e7ac473ae63dc01bba3db7fde
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import { ComponentProps, useMemo } from 'react';
import * as React from 'react';
import { PROP_GROUPS } from '../propMeta';
import {
Box,
FlexBox,
FloatingCard,
GridBox,
Text,
Toggle,
} from '@codecademy/gamut';
import { ArgsTable } from '@storybook/addon-docs/blocks';
import isArray from 'lodash/isArray';
import { ComponentProps, useMemo } from 'react';
import * as React from 'react';

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

import { PROP_GROUPS } from '../propMeta';
import {
PropItem,
PropGroupTooltip,
PropGroupTag,
PropGroupTooltip,
PropItem,
ToggleLabel,
} from './Elements';
import { useSystemProps } from './useSystemProps';
import {
Box,
GridBox,
FlexBox,
Text,
Toggle,
FloatingCard,
} from '@codecademy/gamut/src';
import { Link } from '~styleguide/blocks';

type PropTagProps = {
prop: keyof typeof PROP_GROUPS;
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import styled from '@emotion/styled';
import { ComponentProps } from 'react';
import * as React from 'react';
import { linkTo } from '@storybook/addon-links';
import { useComponentLinks } from '../Navigation';

export const Reset = styled.div`
p:first-of-type {
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ import { ThemeProvider } from '@storybook/theming';
import * as React from 'react';
import { Link } from './Markdown';
import { HelmetProvider } from 'react-helmet-async';
import theme from '../theming/GamutTheme';
import theme from '../../theming/GamutTheme';

const defaultComponents = {
...htmlComponents,
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Anchor } from '@codecademy/gamut';
import { themed } from '@codecademy/gamut-styles';
import styled from '@emotion/styled';
import { linkTo } from '@storybook/addon-links';
import { ComponentProps } from 'react';
@@ -45,3 +46,31 @@ export const Link: React.FC<LinkProps> = ({ ref, id, variant, ...props }) => {
};

export const LinkTo = Link;

export const Code = styled.code`
max-width: 100%;
overflow-x: auto;
line-height: 1;
padding: 5px 7px 1px;
white-space: nowrap;
border-radius: 3px;
font-size: 0.8em;
border: 1px solid ${themed('colors.gray-200')};
color: ${themed('colors.navy-700')};
background-color: ${themed('colors.gray-100')};
display: inline-block;
overflow-x: scroll;

::-webkit-scrollbar {
width: 4px;
height: 4px;
}

::-webkit-scrollbar-thumb {
background: themed('colors.gray-200');
}

::-webkit-scrollbar-track {
background: transparent;
}
`;
Original file line number Diff line number Diff line change
@@ -12,9 +12,10 @@ import { Figma } from '@storybook/addon-designs/blocks';
import { Title } from '@storybook/blocks';
import * as React from 'react';

import { StatusIndicator } from '../StatusIndicator';
import { StatusIndicator } from '../Elements/StatusIndicator';

export interface ComponentHeaderProps {
title?: string;
subtitle?: string;
status?: 'current' | 'updating' | 'deprecated' | 'static';
design?: { url?: string };
@@ -42,6 +43,7 @@ const STATUS = {
} as const;

export const ComponentHeader: React.FC<ComponentHeaderProps> = ({
title,
subtitle,
status: storyStatus = 'static',
design,
@@ -72,8 +74,16 @@ export const ComponentHeader: React.FC<ComponentHeaderProps> = ({
mb={24}
>
<ContentContainer>
<Title />
<Text mb={16}>{subtitle}</Text>
{title ? (
<Text as="h1" fontSize={28 as any}>
{title}
</Text>
) : (
<Title />
)}
<Text mt={8} mb={16}>
{subtitle}
</Text>
{(design?.url || storyStatus !== 'static') && (
<Background p={16} bg="white" borderRadius="md">
<GridBox
51 changes: 51 additions & 0 deletions packages/styleguide/.storybook/components/Scales/ColorScale.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import * as React from 'react';
import { themed } from '@codecademy/gamut-styles';
import styled from '@emotion/styled';
import { Card, GridBox } from '@codecademy/gamut/src';

const HexCode = styled.span`
font-family: ${themed('fontFamily.monospace')};
font-size: 12px;
`;

const Color = styled.div<{ bg?: string }>(({ bg }) => ({
backgroundColor: bg,
}));

export const ColorScale: React.FC<{ colors: Record<string, string> }> = ({
colors,
}) => {
const weights = Object.entries(colors);

return (
<>
<Card
p={0}
width="100%"
borderRadius="md"
display="grid"
minHeight="3rem"
gridAutoFlow="column"
overflow="hidden"
>
{weights.map(([key, hex]) => (
<Color key={`color-${key}`} bg={hex} />
))}
</Card>
<GridBox width="100%" p={4} gridAutoFlow="column">
{weights.map(([key, hex]) => (
<GridBox
key={`hex-${key}`}
alignItems="center"
justifyContent="center"
textAlign="center"
textColor="gray-700"
>
{weights.length > 1 && <HexCode>{key}</HexCode>}
<HexCode>{hex}</HexCode>
</GridBox>
))}
</GridBox>
</>
);
};
3 changes: 2 additions & 1 deletion packages/styleguide/.storybook/components/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './DataTable';
export * from './Headers';
export * from './Markdown';
export * from './Elements/Markdown';
export * from './Scales/ColorScale';
3 changes: 2 additions & 1 deletion packages/styleguide/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -3,13 +3,14 @@ import { Preview } from '@storybook/react';
import theme from './theming/GamutTheme';
import { withEmotion } from './theming/GamutThemeProvider';
import { breakpoints } from '@codecademy/gamut-styles';
import { DocsContainer } from './components/DocsContainer';
import { DocsContainer } from './components/Elements/DocsContainer';

const preview: Preview = {
parameters: {
docs: {
container: DocsContainer,
theme: theme,
toc: { headingSelector: 'h1, h2, h3' },
},
backgrounds: {
disable: true,
2 changes: 0 additions & 2 deletions packages/styleguide/src/lib/Atoms/Logo/Logo.mdx
Original file line number Diff line number Diff line change
@@ -23,8 +23,6 @@ export const parameters = {

<Controls />

// Layouts

## Variants

Variants of the Codecademy logo.
2 changes: 1 addition & 1 deletion packages/styleguide/src/lib/Foundations/About.mdx
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ export const parameters = {
id: 'Foundations',
title: 'Foundations',
subtitle:
'Foundations are the abstract concepts our system is built on: colors, spacing, responsive layouts, and the like.',
'The abstract concepts our system is built on: colors, spacing, responsive layouts, and the like.',
};

<Meta title="Foundations" />
6 changes: 3 additions & 3 deletions packages/styleguide/src/lib/Foundations/Layout.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Box } from '@codecademy/gamut/src';
import { Meta } from '@storybook/blocks';

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

export const parameters = {
title: 'Layout',
subtitle: 'Design guidelines for overall page layout',
status: 'current',
status: 'static',
design: {
type: 'figma',
url: 'https://www.figma.com/file/ReGfRNillGABAj5SlITalN/%F0%9F%93%90-Gamut?node-id=464%3A691',
@@ -15,7 +15,7 @@ export const parameters = {

<Meta title="Foundations/Layout" />

<AboutHeader {...parameters} />
<ComponentHeader {...parameters} />

These are the grids we use for all the screen sizes we design for. We use a 12-column grid approach, meaning every layout can be divided in sections of 2 or 3. It’s important to design with the in mind to create structured and consistent experiences. On smaller screensizes try to avoid using smaller components while using the grid as a guide.

Loading