Skip to content

[2023 Skunkworks] Figma Versions #225

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

Draft
wants to merge 30 commits into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4069b20
figma webhook handler
spark33 Mar 8, 2023
06acab3
comments for adam
spark33 Mar 9, 2023
4364642
new notes for adam wip
spark33 Mar 9, 2023
835e4e2
scaffolding
TheSonOfThomp Mar 9, 2023
97b9892
Update package.json
TheSonOfThomp Mar 9, 2023
042d582
Merge branch 'staging' into 2023-sean-skunkworks
TheSonOfThomp Mar 9, 2023
6ffe083
Step 1
TheSonOfThomp Mar 10, 2023
5101b2a
Step 2
TheSonOfThomp Mar 10, 2023
ecdfcd7
Step 3
TheSonOfThomp Mar 10, 2023
08f0957
fix
TheSonOfThomp Mar 10, 2023
f133a8c
fix
TheSonOfThomp Mar 10, 2023
6370e69
Merge branch '2023-sean-skunkworks' into adam/skunk23
TheSonOfThomp Mar 10, 2023
2cd8e4e
lint
TheSonOfThomp Mar 10, 2023
2a07607
Merge branch 'lint' into 2023-sean-skunkworks
TheSonOfThomp Mar 10, 2023
e97d181
Merge branch '2023-sean-skunkworks' into adam/skunk23
TheSonOfThomp Mar 10, 2023
a8e828d
Move API files
TheSonOfThomp Mar 10, 2023
2f94006
more organization
TheSonOfThomp Mar 10, 2023
ba72fce
Delete req.json
TheSonOfThomp Mar 10, 2023
10fbc7d
update Changelog ui
TheSonOfThomp Mar 10, 2023
e80ffb0
fix
TheSonOfThomp Mar 10, 2023
daf53d1
Merge pull request #223 from mongodb/adam/skunk23
spark33 Mar 10, 2023
de961a5
changes update loop
TheSonOfThomp Mar 10, 2023
a39a627
fix
TheSonOfThomp Mar 10, 2023
d868747
move Figma token
TheSonOfThomp Mar 10, 2023
b46be02
PR cleanup
spark33 Mar 12, 2023
4705ea3
Merge branch '2023-sean-skunkworks' of https://github.com/mongodb/des…
spark33 Mar 12, 2023
f9be9da
subcomponentization
spark33 Mar 13, 2023
9b8371f
segmented control styles
spark33 Mar 13, 2023
7f06f9c
fix ts issues
spark33 Mar 13, 2023
9ccbf90
fix
spark33 Mar 13, 2023
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
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
NEXT_PUBLIC_CONTENTSTACK_API_KEY='apikey'
NEXT_PUBLIC_CONTENTSTACK_DELIVERY_TOKEN='token'
NEXT_PUBLIC_GOOGLE_ANALYTICS='<Tracking_ID>'
NEXT_PUBLIC_GOOGLE_ANALYTICS='<Tracking_ID>'
MDB_USER="<MDB user name>"
MDB_PASSWORD="<password>"
FIGMA_TOKEN="<token>"
2 changes: 1 addition & 1 deletion components/ContentstackRichText/ExampleCardBlock/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const Variant = {
Do: 'do',
} as const;

type Variant = typeof Variant[keyof typeof Variant];
type Variant = (typeof Variant)[keyof typeof Variant];

export { Variant };
2 changes: 1 addition & 1 deletion components/ContentstackRichText/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export interface HorizontalLayoutBlockProps {
column_1: CSNode; // richText
column_2: CSNode; // richText,
vertical_align: 'start' | 'center' | 'end' | 'baseline';
flex_ratio: `${number}:${number}`
flex_ratio: `${number}:${number}`;
}

export interface BlockPropsMap {
Expand Down
6 changes: 3 additions & 3 deletions components/ContentstackRichText/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export const getCSNodeTextContent = (node?: CSNode): string => {

export const nodeHasAssets = (node: CSNode): boolean => {
if (['asset', 'entry', 'reference'].includes(node.type)) {
return true
return true;
} else {
return node.children && node.children.some(child => nodeHasAssets(child))
return node.children && node.children.some(child => nodeHasAssets(child));
}
}
};
8 changes: 4 additions & 4 deletions components/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ const Wrap = {
WrapReverse: 'wrap-reverse',
};

type Direction = typeof Direction[keyof typeof Direction];
type Align = typeof Align[keyof typeof Align];
type Justify = typeof Justify[keyof typeof Justify];
type Wrap = typeof Wrap[keyof typeof Wrap];
type Direction = (typeof Direction)[keyof typeof Direction];
type Align = (typeof Align)[keyof typeof Align];
type Justify = (typeof Justify)[keyof typeof Justify];
type Wrap = (typeof Wrap)[keyof typeof Wrap];

type GridContainerProps = JSX.IntrinsicElements['div'] & {
direction?: Direction;
Expand Down
87 changes: 87 additions & 0 deletions components/pages/changelogs/FigmaChangelogs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { startCase } from 'lodash';

import FigmaIcon from 'components/icons/FigmaIcon';
import ReactIcon from 'components/icons/ReactIcon';

import { palette } from '@leafygreen-ui/palette';
import { spacing } from '@leafygreen-ui/tokens';
import {
Body,
Disclaimer,
H3,
Link,
Subtitle,
} from '@leafygreen-ui/typography';

import { css } from '@emotion/css';

const FigmaChangelogs = ({ componentName, figmaEntries }) => {
return (
<>
{figmaEntries &&
figmaEntries.map(figmaVersion => (
<div
key={JSON.stringify(figmaVersion)}
className={css`
padding: ${spacing[3]}px 0 ${spacing[2]}px;
&:not(:last-child) {
border-bottom: 1px solid ${palette.gray.light2};
}
`}
>
<Disclaimer>
{new Date(figmaVersion.created_at).toDateString()}
</Disclaimer>
<H3 as="h2">{figmaVersion.version}</H3>
<Subtitle>
{startCase(figmaVersion.update_type?.toLowerCase())}
</Subtitle>
<Body
className={css`
margin-bottom: ${spacing[2]}px;
`}
>
{figmaVersion.description}
</Body>
<div>
{figmaVersion.figma_url && (
<Link
target="_blank"
href={figmaVersion.figma_url}
className={css`
span {
display: inline-flex;
align-items: center;
}
`}
>
<FigmaIcon />
Figma Version v{figmaVersion.version}
</Link>
)}
{figmaVersion.react_version && (
<Link
target="_blank"
href={`https://github.com/mongodb/leafygreen-ui/blob/main/packages/${componentName}/CHANGELOG.md#${figmaVersion.react_version.replaceAll(
'.',
'',
)}`}
className={css`
span {
display: inline-flex;
align-items: center;
}
`}
>
<ReactIcon />
React Version v{figmaVersion.react_version}
</Link>
)}
</div>
</div>
))}
</>
);
};

export default FigmaChangelogs;
47 changes: 47 additions & 0 deletions components/pages/changelogs/LogsControl.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import FigmaIcon from 'components/icons/FigmaIcon';
import ReactIcon from 'components/icons/ReactIcon';

import { css } from '@leafygreen-ui/emotion';
import {
SegmentedControl,
SegmentedControlOption,
} from '@leafygreen-ui/segmented-control';
import { spacing } from '@leafygreen-ui/tokens';

const controlOptionStyles = css`
display: flex;
align-items: center;
`;

const controlOptionTextStyles = css`
margin-left: ${spacing[1]}px;
`;

const LogsControl = ({ setDisplayedLogs, figmaEntries, reactVersion }) => {
return (
<div style={{ width: '400px' }}>
<SegmentedControl onChange={setDisplayedLogs}>
{figmaEntries && (
<SegmentedControlOption value="figma">
<div className={controlOptionStyles}>
<FigmaIcon />
<span className={controlOptionTextStyles}>
Figma - v{figmaEntries[0].version}
</span>
</div>
</SegmentedControlOption>
)}
<SegmentedControlOption value="react">
<div className={controlOptionStyles}>
<ReactIcon />
<span className={controlOptionTextStyles}>
React - v{reactVersion}
</span>
</div>
</SegmentedControlOption>
</SegmentedControl>
</div>
);
};

export default LogsControl;
30 changes: 30 additions & 0 deletions components/pages/changelogs/ReactChangelogs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { palette } from '@leafygreen-ui/palette';
import { spacing } from '@leafygreen-ui/tokens';

import { css } from '@emotion/css';

const changelogStyles = css`
color: ${palette.gray.dark3};
pointer-events: none;

& > h2 {
padding-top: ${spacing[3]}px;
border-top: 1px solid ${palette.gray.light2};
}

a {
color: ${palette.gray.dark3};
text-decoration: none;
}
`;

const ReactChangelogs = ({ reactChangelogs }) => {
return (
<div
className={changelogStyles}
dangerouslySetInnerHTML={{ __html: reactChangelogs }}
></div>
);
};

export default ReactChangelogs;
6 changes: 1 addition & 5 deletions components/pages/documentation/CodeDocs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { InstallInstructions } from './InstallInstructions';

function CodeDocs({
componentKebabCaseName,
changelog,
tsDoc,
}: BaseLayoutProps & { tsDoc?: Array<CustomComponentDoc> }) {
const tsDocArray = tsDoc?.sort(
Expand All @@ -30,10 +29,7 @@ function CodeDocs({

return (
<>
<InstallInstructions
componentKebabCaseName={componentKebabCaseName}
changelog={changelog}
/>
<InstallInstructions componentKebabCaseName={componentKebabCaseName} />
{tsDocArray && tsDocArray.length > 0 ? (
<TSDocPropTableSection tsDocArray={tsDocArray} />
) : (
Expand Down
69 changes: 1 addition & 68 deletions components/pages/documentation/InstallInstructions.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { useState } from 'react';

import Button from '@leafygreen-ui/button';
import Card from '@leafygreen-ui/card';
import Copyable from '@leafygreen-ui/copyable';
import { css, cx } from '@leafygreen-ui/emotion';
import { useViewportSize } from '@leafygreen-ui/hooks';
import ActivityFeedIcon from '@leafygreen-ui/icon/dist/ActivityFeed';
import Modal from '@leafygreen-ui/modal';
import { palette } from '@leafygreen-ui/palette';
import {
SegmentedControl,
SegmentedControlOption,
Expand All @@ -30,68 +26,7 @@ const subtitlePadding = css`
padding-bottom: ${spacing[3]}px;
`;

const changelogStyles = css`
color: ${palette.gray.dark3};
pointer-events: none;

& > h2 {
padding-top: ${spacing[3]}px;
border-top: 1px solid ${palette.gray.light2};
}

a {
color: ${palette.gray.dark3};
text-decoration: none;
}
`;

interface VersionCardProps {
version?: string;
changelog: string;
isMobile?: boolean;
}
function VersionCard({
version,
changelog,
isMobile = false,
}: VersionCardProps) {
const [openModal, setOpenModal] = useState(false);

return (
<Card className={cx(topAlignment, cardStyle)}>
<Subtitle as="h2" className={subtitlePadding}>
Version {version}
</Subtitle>
<Button
size={isMobile ? 'large' : 'default'}
leftGlyph={<ActivityFeedIcon />}
onClick={() => setOpenModal(curr => !curr)}
className={cx({
[css`
width: 100%;
`]: isMobile,
})}
>
View Changelog
</Button>
<Modal
className={css`
z-index: 1;
`}
open={openModal}
setOpen={setOpenModal}
>
<div
className={changelogStyles}
dangerouslySetInnerHTML={{ __html: changelog }}
></div>
</Modal>
</Card>
);
}

export const InstallInstructions = ({ componentKebabCaseName, changelog }) => {
const version = changelog?.split('h2')[1]?.replace(/[>/<]+/g, '');
export const InstallInstructions = ({ componentKebabCaseName }) => {
const viewport = useViewportSize();
const isMobile = viewport?.width
? viewport?.width < breakpoints.Tablet
Expand Down Expand Up @@ -138,8 +73,6 @@ export const InstallInstructions = ({ componentKebabCaseName, changelog }) => {
</Copyable>
</div>
</Card>

<VersionCard version={version} changelog={changelog} />
</div>
);
};
2 changes: 1 addition & 1 deletion components/pages/example/Knob/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export interface KnobProps extends HTMLElementProps<'input'> {
value: any;
onChange: (val: any) => void;
darkMode?: boolean;
[key: string]: any
[key: string]: any;
}
4 changes: 2 additions & 2 deletions components/pages/example/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export type KnobType = PropItem & {
max?: number;
step?: number;
disabled?: boolean;
[key: string]: any
}
[key: string]: any;
};
};

export interface LiveExampleState {
Expand Down
16 changes: 10 additions & 6 deletions components/pages/example/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ function getPropItemToKnobTypeMapFn({
StoryFn,
TSDocProp,
}),
args: getOtherControlArgs({meta, StoryFn, TSDocProp})
} as KnobType
}
args: getOtherControlArgs({ meta, StoryFn, TSDocProp }),
} as KnobType;
};
}

/**
Expand Down Expand Up @@ -233,9 +233,13 @@ function getOtherControlArgs({
}: MetadataSources): object | undefined {
const SBInputType = getSBInputType({ meta, StoryFn, TSDocProp });

if (SBInputType && SBInputType.control && typeof SBInputType.control === 'object') {
const {type, ...args} = SBInputType.control
return args
if (
SBInputType &&
SBInputType.control &&
typeof SBInputType.control === 'object'
) {
const { type, ...args } = SBInputType.control;
return args;
}
}

Expand Down
Loading