Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
abf8946
chore: swap gatsby for next
Niznikr Jan 10, 2023
414ab89
refactor: rename static to public
Niznikr Jan 10, 2023
e21023b
chore: use href instead of to for links
Niznikr Jan 10, 2023
4a4a5c2
chore: StaticImage to Image
Niznikr Jan 10, 2023
ff66060
chore: replace helmet with head
Niznikr Jan 11, 2023
354c4f7
chore: support mdx
Niznikr Jan 11, 2023
1a93cf0
chore: update images
Niznikr Jan 11, 2023
df444ce
chore: use next router and load site
Niznikr Jan 11, 2023
61c7aff
chore: remove gatsby from SB
Niznikr Jan 12, 2023
1dfcd62
chore: add google analytics
Niznikr Jan 12, 2023
a321c5f
chore: cleanup
Niznikr Jan 12, 2023
5a56f9f
chore: fetch package data
Niznikr Jan 17, 2023
6c7b5f0
chore: use default layout
Niznikr Jan 18, 2023
a783114
chore: update images
Niznikr Jan 19, 2023
dbecf12
chore: fetch airtable data
Niznikr Jan 21, 2023
048e165
chore: show roadmap
Niznikr Jan 21, 2023
d7b70ea
chore: fetch blog posts
Niznikr Jan 23, 2023
e2c1e1e
chore: fetch static data from json
Niznikr Jan 24, 2023
7d91988
chore: update static props types
Niznikr Jan 24, 2023
e401578
chore: get page headings
Niznikr Jan 24, 2023
3783763
chore: get feature data for pages
Niznikr Jan 24, 2023
a6048df
chore: migrate index pages
Niznikr Jan 24, 2023
695e920
chore: update analytics
Niznikr Jan 25, 2023
a41e714
chore: fix type issues
Niznikr Jan 25, 2023
83945a1
chore: address build errors
Niznikr Jan 25, 2023
ddfa72c
chore: update react-live
Niznikr Jan 25, 2023
d15eae5
chore: use next/image for images
Niznikr Jan 25, 2023
b77a07e
chore: fix data fetch
Niznikr Jan 25, 2023
f87fea3
chore: remove use of static
Niznikr Jan 25, 2023
f58c5db
chore: clean up types
Niznikr Jan 26, 2023
3fb0dbc
chore: update netlify config
Niznikr Jan 26, 2023
0096437
chore: add sitemap
Niznikr Jan 26, 2023
d9499d3
chore: update deps
Niznikr Jan 26, 2023
0c05f3d
chore: migrate intro pages
Niznikr Jan 26, 2023
3c3cd8d
chore: migrate remainings blogs
Niznikr Jan 26, 2023
4c9acab
chore: add manifest
Niznikr Jan 26, 2023
f8fcaa3
chore: include package description
Niznikr Jan 26, 2023
8779dfc
chore: update opengraph
Niznikr Jan 26, 2023
7c3c383
chore: migrate 404
Niznikr Jan 27, 2023
9b1c22d
chore: convert primitive pages except listbox (#2986)
shleewhite Jan 30, 2023
06346d2
chore: update pattern pages to nextjs (#2988)
nkrantz Jan 30, 2023
0a74f82
chore: update foundations pages for nextjs (#2992)
shleewhite Jan 30, 2023
758b723
chore: migrate customization pages
Niznikr Jan 30, 2023
51cbf3c
chore: migrate component pages
Niznikr Jan 30, 2023
acd4b68
chore: update env vars
Niznikr Jan 30, 2023
8fbe995
chore: update context var
Niznikr Jan 30, 2023
97204b6
chore: migrate component pages
Niznikr Jan 30, 2023
a44eb97
chore: update docs
Niznikr Jan 31, 2023
edb3eb9
chore: add linting
Niznikr Jan 31, 2023
e638bf1
chore: add bundle analyzer
Niznikr Jan 31, 2023
c2d1bd1
chore: add docs for mdx
Niznikr Jan 31, 2023
af72556
feat: lazy-load docsearch
Niznikr Jan 31, 2023
427f909
Migrate core pages to Nextjs (#2997)
Jan 31, 2023
105c48e
chore: migrate newsletter
Niznikr Jan 31, 2023
bf07dd6
chore: use next/future/image
Niznikr Feb 1, 2023
38dde8f
chore: update image docs
Niznikr Feb 1, 2023
3a9809e
chore: fix type issues
Niznikr Feb 1, 2023
df7ac59
chore: update gifs location
Niznikr Feb 1, 2023
6029dec
chore: remove gatsby note
Niznikr Feb 1, 2023
c330beb
chore: clean up docsearch logic
Niznikr Feb 1, 2023
e66678f
chore: remove format script
Niznikr Feb 2, 2023
df963ad
chore: migrate detail-text
Niznikr Feb 3, 2023
8285f70
chore: skip checks during build
Niznikr Feb 3, 2023
c5bc23b
chore: add robots
Niznikr Feb 3, 2023
da3e389
chore: fix tests
Niznikr Feb 6, 2023
34501d5
chore: fix stories
Niznikr Feb 6, 2023
9ee20f1
chore: fix regressions
Niznikr Feb 6, 2023
0070f8e
chore: fix test
Niznikr Feb 6, 2023
fec2f1b
chore: vrt corrections
Niznikr Feb 7, 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
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
node_modules
bower_components
lib
Copy link
Contributor

Choose a reason for hiding this comment

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

question: why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have a lib directory in the docs package now for holding things like google analytics (to match practices from the next official examples).

dist
bin
__testfixtures__
Expand All @@ -9,7 +8,6 @@ __fixtures__
packages/paste-icons/cjs
packages/paste-icons/esm
packages/paste-icons/json
packages/paste-website/public
packages/paste-theme-designer/public
packages/paste-theme-designer/out
packages/paste-token-contrast-checker/public
Expand Down
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ module.exports = {
'Public_Description__from_System_',
'Release_Description',
'Release_feature_name',
'page_path',
'event_category',
'event_label',
],
},
],
Expand Down
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ typings/
.env
.env.local

# gatsby files
packages/paste-website/.cache/
packages/paste-website/public

# next.js build output
.next
out/
Expand All @@ -71,7 +67,6 @@ out/

.jest-coverage
.jest-cache
**/lib/*
**/dist/*
packages/**/docs
**/paste-icons/cjs/*
Expand Down
2 changes: 0 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
node_modules
bower_components
lib
dist
bin
__testfixtures__

packages/paste-icons/cjs
packages/paste-icons/esm
packages/paste-icons/json
packages/paste-website/public
packages/paste-theme-designer/public/
.cache
.next
Expand Down
2 changes: 1 addition & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const config: StorybookConfig = {
return mergeConfig(config, {
resolve: {
alias: {
gatsby: path.resolve(__dirname, './gatsby'),
'next/link': path.resolve(__dirname, './next'),
'react-dom/client': path.resolve(__dirname, '../node_modules/react-dom/client'),
'react-dom': path.resolve(__dirname, '../node_modules/react-dom/profiling'),
'scheduler/tracing': path.resolve(__dirname, '../node_modules/scheduler/tracing-profiling'),
Expand Down
2 changes: 1 addition & 1 deletion .storybook/gatsby.tsx → .storybook/next.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import * as React from 'react';

const Link: React.FC = ({children, ...props}) => <a {...props}>{children}</a>;

export {Link};
export default Link;
13 changes: 0 additions & 13 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,3 @@ export const parameters = {
viewports: INITIAL_VIEWPORTS,
},
};

// https://www.gatsbyjs.com/docs/how-to/testing/visual-testing-with-storybook/#manual-configuration

global.___loader = {
enqueue: () => {},
hovering: () => {},
};

global.__BASE_PATH__ = '/';

window.___navigate = (pathname) => {
action('NavigateTo:')(pathname);
};
2 changes: 1 addition & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {defineConfig} from 'cypress';
// eslint-disable-next-line import/no-default-export
export default defineConfig({
e2e: {
baseUrl: 'http://localhost:8000',
baseUrl: 'http://localhost:3000',
env: {
USE_CYPRESS_VRT: process.env.USE_CYPRESS_VRT,
},
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/link-checker/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* USAGE:
* 1. yarn build:website
* 2. yarn serve:website
* 2. yarn start:website
* 3. yarn run cyprus open
* 4. Click the link-checker test in the cyprus window that pops up
*
Expand Down
32 changes: 16 additions & 16 deletions internal-docs/engineering/developing-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@
Before you begin there are some things that you will need to have installed, and some things that we recommend, but are not essential:

1. **[Git](https://git-scm.com/)** - distributed version control. This should be preinstalled on a Mac.
1. `git config --global user.name “first last”`
2. `git config --global user.email johndoe@example.com`
1. `git config --global user.name “first last”`
2. `git config --global user.email johndoe@example.com`
2. **[Xcode Command Line Tools](https://developer.apple.com/xcode/)** - Used to build some Apple software and node packages.
3. **[Homebrew](https://brew.sh/)** (optional)- A package manager for Mac software
1. Follow the installation instructions on the [Homebrew website](https://brew.sh/)
1. Follow the installation instructions on the [Homebrew website](https://brew.sh/)
4. **NodeJS v16.13.x**- A JavaScript runtime for running JavaScript applications
1. Node is preinstalled on Macs but you might need to manage the version that is installed.
1. Node is preinstalled on Macs but you might need to manage the version that is installed.
5. **[NVM](https://github.com/nvm-sh/nvm)** (optional) - A Node version manager that can help installing and managing Node versions on your machine
1. Follow the [installation instructions on NVM](https://github.com/nvm-sh/nvm#installing-and-updating).
1. Follow the [installation instructions on NVM](https://github.com/nvm-sh/nvm#installing-and-updating).
6. **[Yarn](https://classic.yarnpkg.com/en/)** - A package manager for node packages.
1. Install via NPM instructions on the Yarn website [https://classic.yarnpkg.com/en/](https://classic.yarnpkg.com/en/)
2. Paste currently uses v3.
1. Install via NPM instructions on the Yarn website [https://classic.yarnpkg.com/en/](https://classic.yarnpkg.com/en/)
2. Paste currently uses v3.
7. **[Visual Studio Code](https://code.visualstudio.com/)** (optional) - Lightweight IDE that’s really good working with Typescript codebases.
1. Check out the recommended extensions in the extensions tab.
2. We supply some handy React code snippets in the Paste repo too
1. Check out the recommended extensions in the extensions tab.
2. We supply some handy React code snippets in the Paste repo too
8. **Chrome, Edge, Firefox and Safari browsers** - Browsers we support.
9. **[iTerm2](https://iterm2.com/)** - (optional) Handy terminal with many features.
1. We’re fans of zShell coupled with [Oh My Zsh!](https://ohmyz.sh/)
1. We’re fans of zShell coupled with [Oh My Zsh!](https://ohmyz.sh/)
10. **[Connect to Github with SSH](https://docs.github.com/en/authentication/connecting-to-github-with-ssh)** - You'll need this to connect your local machine to Github and clone the Paste repo.
1. Follow the [Github instructions to check if you have an existing SSH key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/checking-for-existing-ssh-keys). If not, continue through the instructions to generate and add a new one.

Expand Down Expand Up @@ -151,19 +151,19 @@ DATADOG_CLIENT_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxx

<table>
<tr>
<td>GATSBY_ENVIRONMENT_CONTEXT
<td>NEXT_PUBLIC_ENVIRONMENT_CONTEXT
</td>
<td>Set to “local”. This replicates <a href="https://docs.netlify.com/configure-builds/environment-variables/#build-metadata">Netlify deployment context</a>
</td>
</tr>
<tr>
<td>GATSBY_DATADOG_APPLICATION_ID
<td>NEXT_PUBLIC_DATADOG_APPLICATION_ID
</td>
<td>Datadog RUM app ID
</td>
</tr>
<tr>
<td>GATSBY_DATADOG_CLIENT_TOKEN
<td>NEXT_PUBLIC_DATADOG_CLIENT_TOKEN
</td>
<td>Datadog RUM client token
</td>
Expand All @@ -181,19 +181,19 @@ DATADOG_CLIENT_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxx
</td>
</tr>
<tr>
<td>GATSBY_DOCSEARCHV3_APIKEY
<td>NEXT_PUBLIC_DOCSEARCHV3_APIKEY
</td>
<td>API key for powering our docs search
</td>
</tr>
<tr>
<td>GATSBY_DOCSEARCHV3_APPID
<td>NEXT_PUBLIC_DOCSEARCHV3_APPID
</td>
<td>Docs search app ID
</td>
</tr>
<tr>
<td>GATSBY_DOCSEARCHV3_INDEXNAME
<td>NEXT_PUBLIC_DOCSEARCHV3_INDEXNAME
</td>
<td>twilio_paste
</td>
Expand Down
93 changes: 55 additions & 38 deletions internal-docs/engineering/doc-site/airtable-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,50 @@

The overview tables and component/pattern headers all use an Airtable integration to gather the data displayed in each.

The Airtable connection is done through the `gatsby-source-airtable` plugin. This uses an api key and pulls all of the Airtable information into a graphql schema. We then use this to populate the component or pattern statuses. Here is an example of the component overview page graphql query:
The Airtable connection is done through the `Airtable JS client`. It uses an api key and allows us to query the Airtable information. We then use this to populate the component or pattern statuses. Here is an example of the query used to fetch all features:
Copy link
Contributor

Choose a reason for hiding this comment

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

praise: love these docs!


```js
allAirtable(
sort: {fields: [data___Feature]}
filter: {data: {status: {ne: null}, Component_Category: {eq: "component"}}}
) {
edges {
node {
data {
Feature
Documentation
Figma
Design_committee_review
Engineer_committee_review
Code
status
}
}
}
}
const airtable = new Airtable({apiKey: process.env.AIRTABLE_APIKEY});
const base = airtable.base(process.env.AIRTABLE_BASEID);

export const systemTable = base('System');

const features = await systemTable
.select({
filterByFormula: 'status',
sort: [{field: 'Feature'}],
fields: [
'Component Category',
'Feature',
'Documentation',
'Figma',
'Design committee review',
'Engineer committee review',
'Code',
'status',
'Product suitability',
],
})
.all();
const items = features.map(({fields}) => fields);
```

In the query, we’re filtering all of the Airtable data by status and Component_Category. Then getting the Feature, Documentation, Figma, etc table data.
The data is then written to a JSON file and made available via the `utils/api` helper functions. The overview pages can then access this data using Next's `getStaticProps` and pass the information to other components:

```js
import {getAllComponents} from '../../utils/api';
Copy link
Contributor

Choose a reason for hiding this comment

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

praise: this approach is much more intuitive imo


export const getStaticProps = async () => {
const components = await getAllComponents(['component', 'layout']);
return {
props: {
componentList: components,
},
};
};
```

In the query, we’re filtering all of the Airtable data by status. Then getting the Feature, Documentation, Figma, etc table data.

In the `component-overview-table` component, we either display the data, pass the data to a conditional, or pass the data to another component like `AssetStatus` or `PeerReviewStatus`.

Expand All @@ -42,29 +62,26 @@ _This can cause some issues with Cypress tests failing if you’re working on a

## Component and pattern headers

The component and pattern headers also get their data from Airtable. In the components, the graphql data is passed to the `PackageStatusLegend` component, where a series of conditionals displays either a `SuccessIcon` or `pending`. The `status` and `Product_suitability` data are used directly in the component or pattern header components.
The component and pattern headers also get their data from Airtable. In the components, the data is passed to the `PackageStatusLegend` component, where a series of conditionals displays either a `SuccessIcon` or `pending`. The `status` and `Product suitability` data are used directly in the component or pattern header components.

Here is an example of the graphql query:
Here is an example:

```js
allAirtable(filter: {data: {Feature: {eq: "Delete"}}}) {
edges {
node {
data {
Documentation
Figma
Design_committee_review
Engineer_committee_review
Code
status
Product_suitability
}
}
}
}
import {getFeature} from '../../../utils/api';

export const getStaticProps = async () => {
const feature = await getFeature('Delete');
return {
props: {
data: {
...feature,
},
},
};
};
```

This query filters all of the Airtable data by Feature name. The feature needs to match exactly what is in Airtable for the data to correctly be fetched. So in this case, if you filtered by “delete”, no data would be fetched, but “Delete” works because the feature in Aritable is “Delete”.
This util filters all of the Airtable data by Feature name. The feature needs to match exactly what is in Airtable for the data to correctly be fetched. So in this case, if you filtered by “delete”, no data would be fetched, but “Delete” works because the feature in Aritable is “Delete”.

## Future state

Expand Down
48 changes: 8 additions & 40 deletions internal-docs/engineering/doc-site/images.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,21 @@
# Images

Images in Gatsby can be unnecessarily complicated, so we should try and keep it as simple as possible by following these guidelines.

## In MDX pages

In MDX favor Markdown syntax for including images. Let Gatsby do the rest.

```mdx
![alt text for image](../relative/path/to/image.png)
```

If you can't use Markdown because you are displaying your image inside a component, first **do not** compose your component in the MDX file. Create a component `tsx` file and import it. Inside you component file, use the [Gatsby Static Image](https://www.gatsbyjs.com/docs/how-to/images-and-media/using-gatsby-plugin-image/#static-images) component.
Use Next's [next/image](https://nextjs.org/docs/api-reference/next/image) component to render statically imported images:

```tsx
import {StaticImage} from 'gatsby-plugin-image';
import Image from 'next/future/image';
import AwaitingData from '../../assets/images/patterns/empty-awaiting-data.png';

export const AwaitingDataImage: React.FC = () => {
return (
<StaticImage
src="../../assets/images/patterns/empty-awaiting-data.png"
alt=""
width={150}
placeholder="blurred"
layout="fixed"
/>
);
return <Image src={AwaitingData} alt="" width={150} placeholder="blur" />;
};
```

## Non-MDX pages

Favor using the [Gatsby Static Image](https://www.gatsbyjs.com/docs/how-to/images-and-media/using-gatsby-plugin-image/#static-images) component.
Next does not apply styles/wrappers to images, so to ensure non-gif images are centered and styled correctly in MDX pages import and use the custom `ResponsiveImage` component which wraps `next/image`:

```tsx
import {StaticImage} from 'gatsby-plugin-image';
import {ResponsiveImage} from '../../components/ResponsiveImage';
import AwaitingData from '../../assets/images/patterns/empty-awaiting-data.png';

export const AwaitingDataImage: React.FC = () => {
return (
<StaticImage
src="../../assets/images/patterns/empty-awaiting-data.png"
alt=""
width={150}
placeholder="blurred"
layout="fixed"
/>
);
};
<ResponsiveImage src={AwaitingData} />;
```

## Dynamic Images (GraphQL)

It is incredibly rare that you should need [Dynamic images](https://www.gatsbyjs.com/docs/how-to/images-and-media/using-gatsby-plugin-image/#dynamic-images). We aren't doing anything fancy right now, **avoid them at all costs**.
19 changes: 19 additions & 0 deletions internal-docs/engineering/doc-site/mdx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# MDX
Copy link
Contributor

Choose a reason for hiding this comment

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

praise: nice addition


MDX is implemented by the [@next/mdx](https://nextjs.org/docs/advanced-features/using-mdx) package. To ensure your page renders correctly, supply the needed navigation data to `getStaticProps` and export the layout component as the default export:

```tsx
import DefaultLayout from '../../../layouts/DefaultLayout';
import {getNavigationData} from '../../../utils/api'; // import this last to avoid issues with the MDXProvider

export default DefaultLayout;

export const getStaticProps = async () => {
const navigationData = await getNavigationData();
return {
props: {
navigationData,
},
};
};
```
Loading