Skip to content

Commit

Permalink
feat: v2 mass components upgrade/migration (#578)
Browse files Browse the repository at this point in the history
* wip

* wip

* wip

* wip

* wip

* wip

* chore: commit wip

* lol idk if this is wise

* lol idk if this is wise

* chore: commit wip

* chore: commit wip

* chore: commit wip

* chore: commit wip

* chore: commit wip

* chore: commit wip

* chore: commit wip

* chore: commit wip

* chore: commit wip

* chore: commit wip

* chore: commit wip

* chore: commit wip

* chore: commit wip

* chore: commit wip

* chore: commit wip

* chore: commit wip

* Upgrade mass boop with v2 (#580)

* fix: i don't know how dialog went mising (#579)

* chore: commit wip

* chore: commit wip

---------

Co-authored-by: Edward Granger <edward.granger@washpost.com>

* chore: commit wip

* fix: correcting merge issue

* fix: remove ui from jest tests

* fix: experiment if pointerevents check will fix close button error in Safari

* fix: prettify dialog test

* fix: prettify dialog test

* fix: tweaking dialog to hopefully pass storybook check in safari

* fix: allow unused react in linter since nextjs wants to play by diff rules lol

* fix: run next link upgrade codemod

* fix: format

---------

Co-authored-by: Edward Granger <edward.granger@washpost.com>
  • Loading branch information
artmsilva and ebgranger committed Feb 27, 2024
1 parent e783d0a commit fe5163d
Show file tree
Hide file tree
Showing 474 changed files with 6,941 additions and 20,643 deletions.
14 changes: 9 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ module.exports = {
rules: {
"react/prop-types": "off",
"@washingtonpost/wpds/theme-colors": "warn",
"no-restricted-syntax": [
"error",
},
},
// warning 'React' is defined but never used @typescript-eslint/no-unused-vars -- allow unused React
{
files: ["**/*.tsx"],
rules: {
"@typescript-eslint/no-unused-vars": [
"warn",
{
selector:
"ImportDeclaration[source.value='react'][specifiers.0.type='ImportDefaultSpecifier']",
message: "Default React import not allowed",
varsIgnorePattern: "React",
},
],
},
Expand Down
5 changes: 1 addition & 4 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { dirname, join } from "path";
require("dotenv").config();

module.exports = {
stories: [
"../packages/kit/src/**/*.stories.tsx",
"../ui/(**|!(node_modules))/src/*.stories.@(ts|tsx|js|jsx)",
],
stories: ["../packages/kit/src/**/*.stories.tsx"],
exclude: ["node_modules", "dist"],

addons: [
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,9 @@ validate:
npm run lint:check
npm run format:check
npm run test

v2-migrate-component:
node scripts/move-component-to-new-dir.js $(componentName)
npx storybook@latest migrate csf-2-to-3 --glob="./packages/kit/src/$(componentName)/*.stories.tsx"
npx jscodeshift ./packages/kit/src/$(componentName) -t ./scripts/transform-wpds-imports.js --extensions=tsx
npx react-codemod update-react-imports ./packages/kit/src
2 changes: 1 addition & 1 deletion apps/nextjs13-approuter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"build-no": "next build",
"start": "next start",
"lint": "next lint"
},
Expand Down
6 changes: 1 addition & 5 deletions apps/nextjs13-pagerouter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"build-no": "next build",
"start": "next start",
"lint": "next lint"
},
Expand All @@ -14,9 +14,5 @@
"next": "13.5.6",
"@washingtonpost/wpds-ui-kit": "*",
"@washingtonpost/wpds-kitchen-sink": "*"
},
"overrides": {
"react": "^18",
"react-dom": "^18"
}
}
2 changes: 1 addition & 1 deletion apps/nextjs14-approuter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"build-no": "next build",
"start": "next start",
"lint": "next lint"
},
Expand Down
6 changes: 1 addition & 5 deletions apps/nextjs14-pagerouter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"build-no": "next build",
"start": "next start",
"lint": "next lint"
},
Expand All @@ -14,9 +14,5 @@
"next": "14.0.3",
"@washingtonpost/wpds-ui-kit": "*",
"@washingtonpost/wpds-kitchen-sink": "*"
},
"overrides": {
"react": "^18",
"react-dom": "^18"
}
}
61 changes: 0 additions & 61 deletions build.washingtonpost.com/.eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion build.washingtonpost.com/components/Contributors.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { theme, Avatar, styled } from "@washingtonpost/wpds-ui-kit";
import { Header } from "~/components/Markdown/Components/headers";

import Image from "next/image";
import Image from "next/legacy/image";
import CustomLink from "./Typography/link";

const StyledGrid = styled({
Expand Down
18 changes: 15 additions & 3 deletions build.washingtonpost.com/components/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ export const Footer = () => {
}}
>
<CommunityHeading>Community</CommunityHeading>
<Link passHref href="https://twitter.com/wpdesignsystem">
<Link
passHref
href="https://twitter.com/wpdesignsystem"
legacyBehavior
>
<Anchor>
<Icon
css={{ marginRight: "$025" }}
Expand All @@ -122,7 +126,11 @@ export const Footer = () => {
Twitter
</Anchor>
</Link>
<Link passHref href="https://github.com/washingtonpost/wpds-ui-kit">
<Link
passHref
href="https://github.com/washingtonpost/wpds-ui-kit"
legacyBehavior
>
<Anchor>
<Icon
css={{ marginRight: "$025" }}
Expand All @@ -135,7 +143,11 @@ export const Footer = () => {
Github
</Anchor>
</Link>
<Link passHref href="https://www.youtube.com/@wpdesignsystem">
<Link
passHref
href="https://www.youtube.com/@wpdesignsystem"
legacyBehavior
>
<Anchor>
<Icon
css={{ marginRight: "$025" }}
Expand Down
20 changes: 14 additions & 6 deletions build.washingtonpost.com/components/Layout/Components/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export default function Sidebar({ navigation, setMobileMenu }) {
<Change type="ComingSoon">Coming soon</Change>
</CustomLink>
) : item.frontMatter.data.status == "Alpha" ? (
<Link href={item.frontMatter.slug} passHref>
<Link href={item.frontMatter.slug} passHref legacyBehavior>
<CustomLink
css={{
display: "flex",
Expand All @@ -216,7 +216,7 @@ export default function Sidebar({ navigation, setMobileMenu }) {
</CustomLink>
</Link>
) : (
<Link href={item.frontMatter.slug} passHref>
<Link href={item.frontMatter.slug} passHref legacyBehavior>
<CustomLink>{item.frontMatter.data.title}</CustomLink>
</Link>
)}
Expand Down Expand Up @@ -264,7 +264,11 @@ export default function Sidebar({ navigation, setMobileMenu }) {
disabled={item.data.status === "Coming soon"}
>
{item.data.status !== "" ? (
<Link href={item.slug} passHref>
<Link
href={item.slug}
passHref
legacyBehavior
>
<CustomLink
css={{
display: "flex",
Expand All @@ -286,7 +290,11 @@ export default function Sidebar({ navigation, setMobileMenu }) {
</CustomLink>
</Link>
) : (
<Link href={item.slug} passHref>
<Link
href={item.slug}
passHref
legacyBehavior
>
<CustomLink>{item.data.title}</CustomLink>
</Link>
)}
Expand All @@ -307,7 +315,7 @@ export default function Sidebar({ navigation, setMobileMenu }) {
onClick={() => setMobileMenu(false)}
isCurrent={router.asPath.includes("release-notes") ? "active" : ""}
>
<Link href="/release-notes" passHref>
<Link href="/release-notes" passHref legacyBehavior>
<Header>
<CustomLink css={{ color: "$primary" }}>
Release Notes
Expand All @@ -318,7 +326,7 @@ export default function Sidebar({ navigation, setMobileMenu }) {
<ListItem
isCurrent={router.asPath.includes("support") ? "active" : ""}
>
<Link href="/support" passHref>
<Link href="/support" passHref legacyBehavior>
<Header>
<CustomLink css={{ color: "$primary" }}>Support</CustomLink>
</Header>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { styled, css } from "@washingtonpost/wpds-ui-kit";
import Image from "next/image";
import Image from "next/legacy/image";

export default function InlineImage({
maxWidth,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import Image from "next/image";
import Image from "next/legacy/image";
import {
css,
Icon,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { ReactSVG } from "react-svg";
import Tokens from "@washingtonpost/wpds-theme/src/wpds.tokens.json";
import Image from "next/image";
import Tokens from "@washingtonpost/wpds-ui-kit/src/theme/wpds.tokens.json";
import Image from "next/legacy/image";
import { css, styled } from "@washingtonpost/wpds-ui-kit";

const SVGContainer = styled("div", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function CustomLink({
});

return (
<Link as={as} href={href} forceHref passHref>
<Link as={as} href={href} forceHref passHref legacyBehavior>
<A
id={id}
signal={useSignal ? "showColor" : ""}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { styled } from "@washingtonpost/wpds-ui-kit";
import Tokens from "@washingtonpost/wpds-theme/src/wpds.tokens.json";
import Tokens from "@washingtonpost/wpds-ui-kit/src/theme/wpds.tokens.json";

/**
* Table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const LinkText = styled("a", {

const Item = ({ children, level, label, as, href }) => (
<ListItem level={level} label={label}>
<Link passHref as={as} href={href}>
<Link passHref as={as} href={href} legacyBehavior>
<LinkText>{children}</LinkText>
</Link>
</ListItem>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from "react";
import { Box, styled, AlertBanner, theme } from "@washingtonpost/wpds-ui-kit";
import { toast } from "react-toastify";
import Tokens from "@washingtonpost/wpds-theme/src/wpds.tokens.json";
import Tokens from "@washingtonpost/wpds-ui-kit/src/theme/wpds.tokens.json";

import { Grid } from "../Components/Grid";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from "react";
import { Box, styled, AlertBanner, theme } from "@washingtonpost/wpds-ui-kit";
import { toast } from "react-toastify";
import Tokens from "@washingtonpost/wpds-theme/src/hexcodes.tokens.json";
import Tokens from "@washingtonpost/wpds-ui-kit/src/theme/hexcodes.tokens.json";
import { StyledItem, StyledToggleGroup } from "../Components/ToggleGroupRadix";
import { Grid } from "../Components/Grid";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as AllAssets from "@washingtonpost/wpds-assets";
import { toast } from "react-toastify";
import MDXStyling from "~/components/Markdown/Styling";
import { Grid } from "../Components/Grid";
import { InputText } from "@washingtonpost/wpds-input-text";
import { InputText } from "@washingtonpost/wpds-ui-kit";
import Search from "@washingtonpost/wpds-assets/asset/search";
import { Icon, theme, AlertBanner, Box } from "@washingtonpost/wpds-ui-kit";
import { paramCase } from "param-case";
Expand Down
2 changes: 1 addition & 1 deletion build.washingtonpost.com/components/Markdown/Styling.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from "~/components/Markdown/Components/list";
import dynamic from "next/dynamic";
import { Grid, Cell } from "./Components/Grid";
import { AlertBanner } from "@washingtonpost/wpds-alert-banner";
import { AlertBanner } from "@washingtonpost/wpds-ui-kit";
import { ComponentStatus } from "../ComponentPage/ComponentStatus";
import CollapsibleContainer from "./Components/collapsible";
const InputCheckbox = dynamic(() =>
Expand Down
6 changes: 3 additions & 3 deletions build.washingtonpost.com/components/NavigationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export const NavigationBar = ({ setMobileMenu, mobileMenuState, isClosed }) => {
</Container>
<List role="navigation" aria-label="Support and search">
<ListItem>
<Link href="/release-notes" passHref>
<Link href="/release-notes" passHref legacyBehavior>
<Anchor
isCurrent={router.asPath.includes("/release-notes")}
onClick={() => setMobileMenu(!mobileMenuState)}
Expand All @@ -207,14 +207,14 @@ export const NavigationBar = ({ setMobileMenu, mobileMenuState, isClosed }) => {
</Link>
</ListItem>
<ListItem>
<Link href="/resources" passHref>
<Link href="/resources" passHref legacyBehavior>
<Anchor isCurrent={router.asPath.includes("/resources")}>
Resources
</Anchor>
</Link>
</ListItem>
<ListItem css={{ margin: "0 $100 0 0" }}>
<Link href="/support" passHref>
<Link href="/support" passHref legacyBehavior>
<Anchor isCurrent={router.asPath.includes("/support")}>
Support
</Anchor>
Expand Down
2 changes: 1 addition & 1 deletion build.washingtonpost.com/components/Thumbnail.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { P } from "~/components/Markdown/Styling";

import { ThumbnailGrid } from "./Markdown/Components/ResourcesGrids";

import Image from "next/image";
import Image from "next/legacy/image";

export const THUMBNAIL_WIDE = "wide";
export const THUMBNAIL_SQUARE = "square";
Expand Down
Loading

0 comments on commit fe5163d

Please sign in to comment.