Skip to content

Commit

Permalink
Updating tools and dependencies to latest versions, fixed breaking ch…
Browse files Browse the repository at this point in the history
…anges
  • Loading branch information
anaximander committed Sep 22, 2023
1 parent f9c6fcb commit d6c3887
Show file tree
Hide file tree
Showing 38 changed files with 20,045 additions and 15,502 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SKIP_PREFLIGHT_CHECK=true
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
/.pnp
.pnp.js

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# testing
/coverage

Expand Down
11 changes: 0 additions & 11 deletions .storybook/main.js

This file was deleted.

21 changes: 21 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { StorybookConfig } from "@storybook/react-webpack5";

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/preset-create-react-app",
"@storybook/addon-onboarding",
"@storybook/addon-interactions",
],
framework: {
name: "@storybook/react-webpack5",
options: {},
},
docs: {
autodocs: true,
},
staticDirs: ["../public"],
};
export default config;
4 changes: 0 additions & 4 deletions .storybook/preview.js

This file was deleted.

15 changes: 15 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Preview } from "@storybook/react";

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
};

export default preview;
874 changes: 874 additions & 0 deletions .yarn/releases/yarn-3.6.3.cjs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarnPath: .yarn/releases/yarn-3.6.3.cjs
73 changes: 45 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "mapc-design-system",
"author": "MAPC Digital Services",
"version": "0.3.5",
"private": false,
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand Down Expand Up @@ -36,14 +35,15 @@
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"storybook": "start-storybook -p 6006 -s public",
"build-storybook": "build-storybook -o docs -s ./src/assets",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"compile": "tsc && rm -rf dist && mkdir dist && NODE_ENV=production babel src --out-dir dist --extensions .ts,.tsx && mkdir -p ./dist/assets/images && cp -a ./src/assets/images ./dist/assets/"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
"react-app/jest",
"plugin:storybook/recommended"
]
},
"browserslist": {
Expand All @@ -59,40 +59,57 @@
]
},
"dependencies": {
"@babel/core": "^7.22.20",
"@babel/runtime": "^7.13.10",
"@emotion/react": "^11.1.4",
"@fortawesome/fontawesome-svg-core": "^1.2.34",
"@fortawesome/free-brands-svg-icons": "^5.15.2",
"@fortawesome/free-solid-svg-icons": "^5.15.2",
"@fortawesome/react-fontawesome": "^0.1.14",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.15",
"@types/node": "^12.0.0",
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
"@fortawesome/fontawesome-svg-core": "^6.4.2",
"@fortawesome/free-brands-svg-icons": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"@fortawesome/react-fontawesome": "^0.2.0",
"@testing-library/dom": "^9.3.3",
"@testing-library/jest-dom": "^6.1.3",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.5.1",
"@types/jest": "^29.5.5",
"@types/node": "^20.6.3",
"@types/react": "^18.2.22",
"@types/react-dom": "^18.2.7",
"mapbox-gl": "^2.1.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.1",
"typescript": "^4.0.3",
"web-vitals": "^0.2.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"typescript": "^5.2.2",
"web-vitals": "^3.4.0",
"worker-loader": "^3.0.8"
},
"devDependencies": {
"@babel/cli": "^7.12.10",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/preset-react": "^7.12.10",
"@storybook/addon-actions": "^6.1.15",
"@storybook/addon-essentials": "^6.1.15",
"@storybook/addon-links": "^6.1.15",
"@storybook/node-logger": "^6.1.15",
"@storybook/preset-create-react-app": "^3.1.5",
"@storybook/react": "^6.1.15",
"@types/mapbox-gl": "^2.1.0"
"@storybook/addon-actions": "^7.4.4",
"@storybook/addon-docs": "^7.4.4",
"@storybook/addon-essentials": "^7.4.4",
"@storybook/addon-interactions": "^7.4.4",
"@storybook/addon-links": "^7.4.4",
"@storybook/addon-onboarding": "^1.0.8",
"@storybook/blocks": "^7.4.4",
"@storybook/node-logger": "^7.4.4",
"@storybook/preset-create-react-app": "^7.4.4",
"@storybook/react": "^7.4.4",
"@storybook/react-webpack5": "^7.4.4",
"@storybook/testing-library": "^0.2.1",
"@types/mapbox-gl": "^2.1.0",
"babel-plugin-named-exports-order": "^0.0.2",
"eslint": "^8.50.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-storybook": "^0.6.14",
"prop-types": "^15.8.1",
"storybook": "^7.4.4",
"webpack": "^5.88.2"
},
"repository": {
"url": "https://github.com/MAPC/mapc-design-system",
"type": "git"
}
},
"packageManager": "[email protected]"
}
3 changes: 2 additions & 1 deletion src/components/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
/** @jsx jsx */

import * as React from 'react';
import { PropsWithChildren } from 'react';
import { css, jsx } from '@emotion/react';
import { MetrocommonTriangle } from './MetrocommonTriangle';

export interface AccordionProps {
export type AccordionProps = React.PropsWithChildren & {
triangleColor?: string,
title: React.ReactElement
}
Expand Down
6 changes: 4 additions & 2 deletions src/components/MetrocommonTriangle.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as React from 'react';
import { PropsWithChildren } from 'react';
import { css, jsx } from '@emotion/react';

export interface MetrocommonTriangleProps {
export type MetrocommonTriangleProps = React.PropsWithChildren & {
color: string|undefined,
}

Expand All @@ -9,4 +11,4 @@ export const MetrocommonTriangle: React.FC<MetrocommonTriangleProps> = ({ color=
<title id="triangleTitle">Decorative triangle</title>
<path id="Polygon_10" data-name="Polygon 10" d="M10.588,0,21.176,20H0Z" transform="translate(20) rotate(90)" fill={color}/>
</svg>
);
);
1 change: 1 addition & 0 deletions src/react-app-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="react-scripts" />
50 changes: 50 additions & 0 deletions src/stories/Button.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import type { Meta, StoryObj } from '@storybook/react';

import { Button } from './Button';

// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
const meta = {
title: 'Example/Button',
component: Button,
parameters: {
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
layout: 'centered',
},
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
tags: ['autodocs'],
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
argTypes: {
backgroundColor: { control: 'color' },
},
} satisfies Meta<typeof Button>;

export default meta;
type Story = StoryObj<typeof meta>;

// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
export const Primary: Story = {
args: {
primary: true,
label: 'Button',
},
};

export const Secondary: Story = {
args: {
label: 'Button',
},
};

export const Large: Story = {
args: {
size: 'large',
label: 'Button',
},
};

export const Small: Story = {
args: {
size: 'small',
label: 'Button',
},
};
48 changes: 48 additions & 0 deletions src/stories/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React from 'react';
import './button.css';

interface ButtonProps {
/**
* Is this the principal call to action on the page?
*/
primary?: boolean;
/**
* What background color to use
*/
backgroundColor?: string;
/**
* How large should the button be?
*/
size?: 'small' | 'medium' | 'large';
/**
* Button contents
*/
label: string;
/**
* Optional click handler
*/
onClick?: () => void;
}

/**
* Primary UI component for user interaction
*/
export const Button = ({
primary = false,
size = 'medium',
backgroundColor,
label,
...props
}: ButtonProps) => {
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
return (
<button
type="button"
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
style={{ backgroundColor }}
{...props}
>
{label}
</button>
);
};
27 changes: 27 additions & 0 deletions src/stories/Header.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { Meta, StoryObj } from '@storybook/react';

import { Header } from './Header';

const meta = {
title: 'Example/Header',
component: Header,
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
tags: ['autodocs'],
parameters: {
// More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout
layout: 'fullscreen',
},
} satisfies Meta<typeof Header>;

export default meta;
type Story = StoryObj<typeof meta>;

export const LoggedIn: Story = {
args: {
user: {
name: 'Jane Doe',
},
},
};

export const LoggedOut: Story = {};
Loading

0 comments on commit d6c3887

Please sign in to comment.