Skip to content

Commit 62ee932

Browse files
authored
Ground Nav v2 (#2194)
This PR updates the Ground Nav component to version two. This version intentionally drops the "PWA Stats" use case, and so is a breaking change. The intent of this redesign is largely to allow for two "feature" blocks which could be configured. The layout is meant to handle zero, one, or two features automatically.
1 parent fa63628 commit 62ee932

File tree

15 files changed

+637
-372
lines changed

15 files changed

+637
-372
lines changed

gulpfile.js/tasks/build-scripts.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const fs = require('node:fs').promises;
22
const path = require('node:path');
33

44
const { getBabelInputPlugin } = require('@rollup/plugin-babel');
5+
const json = require('@rollup/plugin-json');
56
const nodeResolve = require('@rollup/plugin-node-resolve').default;
67
const rollup = require('rollup');
78
const dts = require('rollup-plugin-dts').default;
@@ -67,6 +68,7 @@ const buildJS = async () => {
6768
virtualRootPlugin(),
6869
getBabelInputPlugin({ extensions, babelHelpers: 'bundled' }),
6970
nodeResolve({ extensions }),
71+
json(),
7072
],
7173
});
7274
await Promise.all([

package-lock.json

Lines changed: 91 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"@cloudfour/eslint-plugin": "21.1.0",
4848
"@etchteam/storybook-addon-status": "4.2.2",
4949
"@rollup/plugin-babel": "6.0.3",
50+
"@rollup/plugin-json": "^6.0.0",
5051
"@rollup/plugin-node-resolve": "13.3.0",
5152
"@storybook/addon-a11y": "6.5.9",
5253
"@storybook/addon-docs": "6.5.9",

src/assets/illustrations/portland.svg

Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{
22
"items": [
3-
{ "link": "/portland-device-lab", "title": "Device Lab" },
4-
{ "link": "https://cloudfour-patterns.netlify.app/", "title": "Patterns" },
5-
{
6-
"link": "https://www.responsivefieldday.com/",
7-
"title": "Responsive Field Day"
8-
}
3+
{ "link": "https://cloudfour-patterns.netlify.app/", "title": "Patterns" }
94
]
105
}
Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
{
22
"items": [
33
{
4-
"link": "https://twitter.com/cloudfour",
5-
"title": "Follow us on Twitter",
6-
"icon": "brands/twitter"
4+
"link": "https://www.linkedin.com/company/cloud-four",
5+
"title": "Follow us on LinkedIn",
6+
"icon": "brands/linkedin"
77
},
88
{
9-
"link": "https://github.com/cloudfour",
10-
"title": "Find us on GitHub",
11-
"icon": "brands/github"
9+
"link": "https://www.youtube.com/channel/UC39ZT0CMds5z0K0Z7RWa98A",
10+
"title": "Follow us on YouTube",
11+
"icon": "brands/youtube"
1212
},
1313
{
1414
"link": "https://www.instagram.com/cloudfourpdx/",
1515
"title": "Follow us on Instagram",
1616
"icon": "brands/instagram"
1717
},
1818
{
19-
"link": "https://www.linkedin.com/company/cloud-four",
20-
"title": "Follow us on LinkedIn",
21-
"icon": "brands/linkedin"
19+
"link": "https://github.com/cloudfour",
20+
"title": "Find us on GitHub",
21+
"icon": "brands/github"
22+
},
23+
{
24+
"link": "/feed/atom/",
25+
"title": "Subscribe to our RSS Feed",
26+
"icon": "feed"
2227
}
2328
]
2429
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"items": [
3+
{ "link": "/topics/rwd", "title": "Responsive Web Design" },
4+
{ "link": "/topics/ecommerce", "title": "Ecommerce" },
5+
{ "link": "/topics/performance", "title": "Performance" },
6+
{ "link": "/topics/images", "title": "Images" },
7+
{ "link": "/topics/accessibility", "title": "Accessibility" },
8+
{ "link": "/topics/spotlight", "title": "Cloud Four Spotlight" },
9+
{ "link": "/topics/css", "title": "CSS" },
10+
{ "link": "/topics/essentials", "title": "Essentials" }
11+
]
12+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
// eslint-disable-next-line @cloudfour/import/order
2+
import skyNavMenu from '../sky-nav/demo/menu.json';
3+
import groundNavMenu from './demo/menu.json';
4+
import organization from './demo/organization.json';
5+
import social from './demo/social.json';
6+
import topics from './demo/topics.json';
7+
const menu = { items: [...skyNavMenu.items, ...groundNavMenu.items] };
8+
9+
/**
10+
* Default args for Ground Nav stories
11+
*
12+
* Currently storybook doesn't have support for nested or grouped args.
13+
* @see https://github.com/storybookjs/storybook/issues/11525
14+
* @see https://github.com/storybookjs/storybook/issues/10979
15+
*/
16+
export const defaultArgs = {
17+
alternate: false,
18+
features: 2,
19+
organizationName: organization.name,
20+
organizationStreetAddress: organization.address.street_address,
21+
organizationAddressLocality: organization.address.address_locality,
22+
organizationAddressRegion: organization.address.address_region,
23+
organizationPostalCode: organization.address.postal_code,
24+
organizationAddressCountry: organization.address.address_country,
25+
organizationEmail: organization.email,
26+
organizationTelephone: organization.telephone,
27+
organizationUrl: organization.url,
28+
organizationFoundingDate: organization.founding_date,
29+
};
30+
31+
/**
32+
* Storybook arg types for the defaultArgs
33+
*/
34+
export const defaultArgTypes = {
35+
alternate: { control: { type: 'boolean' } },
36+
features: { control: { type: 'number', min: 0, max: 2 } },
37+
organizationName: { type: { name: 'string' } },
38+
organizationStreetAddress: { type: { name: 'string' } },
39+
organizationAddressLocality: { type: { name: 'string' } },
40+
organizationAddressRegion: { type: { name: 'string' } },
41+
organizationPostalCode: { type: { name: 'string' } },
42+
organizationAddressCountry: { type: { name: 'string' } },
43+
organizationEmail: { type: { name: 'string' } },
44+
organizationTelephone: { type: { name: 'string' } },
45+
organizationUrl: { type: { name: 'string' } },
46+
organizationFoundingDate: { type: { name: 'string' } },
47+
};
48+
49+
/**
50+
* Generate Ground Nav Template Props
51+
*
52+
* Takes the flat args object and structures it as the template expects.
53+
*
54+
* @param {defaultArgs} args
55+
*/
56+
export const generateGroundNavProps = (args) => ({
57+
menu,
58+
social,
59+
topics,
60+
alternate: args.alternate,
61+
features: args.features,
62+
organization: {
63+
name: args.organizationName,
64+
address: {
65+
street_address: args.organizationStreetAddress,
66+
address_locality: args.organizationAddressLocality,
67+
address_region: args.organizationAddressRegion,
68+
postal_code: args.organizationPostalCode,
69+
address_country: args.organizationAddressCountry,
70+
},
71+
email: args.organizationEmail,
72+
telephone: args.organizationTelephone,
73+
url: args.organizationUrl,
74+
founding_date: args.organizationFoundingDate,
75+
},
76+
});

0 commit comments

Comments
 (0)