This repository has been archived by the owner on Jun 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into video-controls
* main: Add the catalog site (#137) Delete dependabot.yml Only direct dependencies Create dependabot.yml (#296) Update Travis bad Update devDependencies (#294)
- Loading branch information
Showing
222 changed files
with
25,781 additions
and
11,761 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
node_modules | ||
*.log | ||
dist | ||
coverage | ||
.DS_Store | ||
**/_batfish* | ||
src/docs/data | ||
src/components/*/index.js | ||
packages/**/package-lock.json | ||
_batfish* | ||
pkg | ||
src/test-cases-app/component-index.js | ||
dist | ||
docs/src/data/components.js | ||
_site* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
<!-- list what changes this PR introduces --> | ||
|
||
## How to test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{ | ||
"*.js": ["eslint", "prettier --write", "git add"], | ||
"*.css": ["prettier --write", "git add"] | ||
"*.js": ["eslint", "prettier --write"], | ||
"*.css": ["prettier --write"], | ||
"*.md": ["prettier --write"], | ||
"*.json": ["prettier --write"], | ||
"*.yml": ["prettier --write"] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Contributing | ||
|
||
This repo has two sites: | ||
|
||
- **The [catalog site](https://mapbox.github.io/dr-ui/) built with Batfish.** | ||
- The catalog contains examples of most common uses for each component and lists all available properties. | ||
- To make sure all our components are production ready with Batfish, CI runs the `npm run build-docs`. | ||
- Every catalog example must have a test case. | ||
- **The test cases app available locally.** | ||
- The test cases app builds a local development site and snapshot tests for each component. The test cases app also includes less common use cases. | ||
|
||
## Commands | ||
|
||
To run the catalog site at https://mapbox.github.io/dr-ui/: | ||
|
||
``` | ||
npm run start-docs | ||
``` | ||
|
||
To build the test cases app: | ||
|
||
```bash | ||
npm start | ||
``` | ||
|
||
To run the tests: | ||
|
||
``` | ||
npm test | ||
``` | ||
|
||
## Tests | ||
|
||
Every component should have a `__tests__` directory with the following files: | ||
|
||
- `/[component-name]-test-cases.js`. The `*test-cases.js` file includes variations of the component to demonstrate different capabilities and properties for the component. Every catalog example must have a test case. | ||
- `/[component-name].test.js`. The `*.test.js` file should create a unit test for each test case found in `*test-cases.js`. | ||
|
||
## Add a new component | ||
|
||
Run the `new` command to generate all the files and starter code to create a new component. The command accepts an argument with the name of the component: | ||
|
||
``` | ||
node scripts/new.js Button | ||
node scripts/new.js responsive button | ||
``` | ||
|
||
The command will create the following folder structure: | ||
|
||
``` | ||
src/components/[component-name]/ | ||
index.js | ||
[component-name].js | ||
examples/ | ||
basic.js | ||
__tests__/ | ||
[component-name]-test-cases.js | ||
[component-name].test.js | ||
``` | ||
|
||
## Publish a new dr-ui version | ||
|
||
The `build` command creates a `pkg/` directory that contains the code we want to publish, organized the way we want it. So `pkg/` is the directory that we publish. `pkg/package.json` is a clone of `package.json` but with `private: true` removed. | ||
|
||
1. Document changes in the CHANGELOG. | ||
1. Increment the version key in package.json and package-lock.json. | ||
1. Make sure all this is committed, typically with a commit message like `Prepare 0.0.11`. | ||
1. Create a tag. No message is necessary, since the changelog includes explanations of changes. For example: `git tag -a 0.0.11 -m ""`. | ||
1. Push the tag: `git push --tags`. | ||
1. Push your commit. | ||
1. Build the `pkg/` directory: `npm run build`. | ||
1. `cd` into the `pkg/` directory and publish the new version on npm. | ||
1. `cd` back to the root directory and run `npm run deploy-docs` to deploy the catalog site. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": ["../conf/eslint-config-base.json", "@mapbox/eslint-config-docs"], | ||
"rules": { | ||
"es/no-object-assign": "off", | ||
"react/prop-types": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const path = require('path'); | ||
|
||
module.exports = () => { | ||
return { | ||
siteBasePath: '/dr-ui', | ||
outputDirectory: path.join(__dirname, '_site/'), | ||
temporaryDirectory: path.join(__dirname, '_site_tmp/'), | ||
stylesheets: [ | ||
require.resolve('@mapbox/mbx-assembly/dist/assembly.css'), | ||
require.resolve('../src/css/docs-prose.css'), | ||
require.resolve('../src/css/prism.css'), | ||
require.resolve('./src/css/site.css') | ||
] | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import React from 'react'; | ||
import components from './data/components'; // eslint-disable-line | ||
import ComponentSection from './components/component-section'; | ||
import Sidebar from './components/sidebar'; | ||
import Topbar from '../../src/components/topbar'; | ||
import ProductMenu from '../../src/components/product-menu'; | ||
import OverviewHeader from '../../src/components/overview-header'; | ||
import Note from '../../src/components/note'; | ||
import PageLayout from '../../src/components/page-layout'; | ||
import categories from './categories.json'; | ||
|
||
const version = require('../../package.json').version; | ||
|
||
export default class App extends React.Component { | ||
componentDidMount() { | ||
// override SectionedNavigation scroll | ||
const sideBar = document.getElementById('dr-ui--page-layout-sidebar'); | ||
if (!sideBar) return; | ||
sideBar.scrollTop = 0; | ||
} | ||
render() { | ||
const componentEls = Object.keys(categories).map((category) => { | ||
return ( | ||
<div key={category}> | ||
<h2 className="txt-fancy txt-h3" id={category.toLowerCase()}> | ||
{category} | ||
</h2> | ||
{categories[category].sort().map((comp) => { | ||
const component = components.filter((f) => f.name === comp)[0]; | ||
return ( | ||
<div | ||
key={component.name} | ||
className="pt30 mb30 border-t border--darken10" | ||
> | ||
<ComponentSection data={component} /> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
); | ||
}); | ||
return ( | ||
<div> | ||
<Topbar> | ||
<div className="limiter"> | ||
<div className="grid"> | ||
<div className="col col--4-mm col--12"> | ||
<div className="ml18-mm pt12" style={{ height: 52 }}> | ||
<ProductMenu productName="Dr. UI" homePage="/dr-ui/" /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</Topbar> | ||
<div className="limiter"> | ||
<PageLayout | ||
sideBarColSize={3} | ||
sidebarContentStickyTop={0} | ||
sidebarContentStickyTopNarrow={0} | ||
sidebarContent={<Sidebar />} | ||
> | ||
<div className="prose"> | ||
<OverviewHeader | ||
features={[ | ||
'React components', | ||
'Support for IE11 and all modern browsers' | ||
]} | ||
image={<div />} | ||
title="Dr. UI" | ||
version={version} | ||
changelogLink="https://github.com/mapbox/dr-ui/blob/master/CHANGELOG.md" | ||
installLink="https://github.com/mapbox/dr-ui/blob/master/README.md" | ||
ghLink="https://github.com/mapbox/dr-ui" | ||
/> | ||
|
||
<p> | ||
Pronounced "Doctor UI". <strong>D</strong>ocumentation{' '} | ||
<strong>R</strong>eact <strong>UI</strong> components.{' '} | ||
<a href="https://mapbox.github.io/mr-ui/">See @mapbox/mr-ui</a>. | ||
</p> | ||
|
||
<p>UI components for Mapbox documentation projects.</p> | ||
|
||
<Note> | ||
<p> | ||
This project is for internal Mapbox usage. The code is open | ||
source and we appreciate bug reports; but we will only | ||
consider feature requests and pull requests from Mapbox | ||
developers. | ||
</p> | ||
</Note> | ||
</div> | ||
{componentEls} | ||
</PageLayout> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
Oops, something went wrong.