Skip to content

Commit

Permalink
chore: node 20, mv components directory src to root, add emulsify-cor…
Browse files Browse the repository at this point in the history
…e as only dependency
  • Loading branch information
joetower committed Mar 22, 2024
1 parent dd16c60 commit a945408
Show file tree
Hide file tree
Showing 214 changed files with 18,144 additions and 51,744 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.13
20
35 changes: 33 additions & 2 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,43 @@
module.exports = {
stories: [
'../src/components/**/*.stories.mdx',
'../src/components/**/*.stories.@(js|jsx|ts|tsx)',
'../components/**/*.stories.mdx',
'../components/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: [
'@storybook/addon-a11y',
'@storybook/addon-links',
'@storybook/addon-essentials',
'storybook-addon-designs',
{
name: '@storybook/addon-styling-webpack',
options: {
rules: [
// Replaces existing CSS rules to support PostCSS
{
test: /\.css$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: { importLoaders: 1 },
},
],
},
],
},
},
],

core: {
builder: 'webpack5',
},

framework: {
name: '@storybook/html-webpack5',
options: {},
},

docs: {
autodocs: true,
},
};
22 changes: 13 additions & 9 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import { addDecorator } from '@storybook/html';
import { useEffect } from '@storybook/client-api';
import Twig from 'twig';
import { setupTwig } from './setupTwig';
import { withDesign } from 'storybook-addon-designs';

// GLOBAL CSS
import '../src/style.scss';
import '../dist/style.css';

// If in a Drupal project, it's recommended to import a symlinked version of drupal.js.
import './_drupal.js';

// addDecorator deprecated, but not sure how to use this otherwise.
addDecorator((storyFn) => {
useEffect(() => Drupal.attachBehaviors(), []);
return storyFn();
});
export const decorators = [
(Story, { args }) => {
const { renderAs } = args || {};

// Usual emulsify hack to add Drupal behaviors.
useEffect(() => {
Drupal.attachBehaviors();
}, [args]);
return Story();
},
];

setupTwig(Twig);

Expand All @@ -33,7 +37,7 @@ export const parameters = {
'*',
'WIP',
],
includeNames: true
includeNames: true,
},
},
};
2 changes: 1 addition & 1 deletion .storybook/setupTwig.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const twigBEM = require('bem-twig-extension');
const twigAddAttributes = require('add-attributes-twig-extension');

module.exports.namespaces = {
components: resolve(__dirname, '../', 'src/components'),
components: resolve(__dirname, '../', 'components'),
};

/**
Expand Down
2 changes: 1 addition & 1 deletion .storybook/setupTwig.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('setupTwig', () => {

it('exports emulsifys namespaces', () => {
expect(namespaces).toEqual({
components: '../src/components',
components: '../components',
});
});
});
2 changes: 1 addition & 1 deletion .stylelintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules
src/components/tokens/_tokens.scss
components/tokens/_tokens.scss
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* stylelint-disable no-descending-specificity */
@use '../../stylesheets/mixins.scss';
@use '../tokens/tokens' as *;
@use '../../src/stylesheets/mixins' as *;

$accordion_icon_size: var(--size-xl);
$accordion-icon-size: var(--size-xl);

// The accordion group.
.accordion {
Expand Down Expand Up @@ -103,8 +104,8 @@ $accordion_icon_size: var(--size-xl);

.accordion-item__icon {
margin-left: auto;
height: $accordion_icon_size;
width: $accordion_icon_size;
height: $accordion-icon-size;
width: $accordion-icon-size;
fill: var(--accordion-color-header);

[aria-expanded='true'] > & {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import template from './audio-player.twig';
import audioData from './audio-player.yml';
import figma from '../../../.storybook/configma.json';
import figma from '../../.storybook/configma.json';

export default {
title: 'Components/Media/Audio Player',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../tokens/tokens';
// @use '../../src/tokens/figma.tokens.json';

.button {
background-color: var(--button-color-bkg);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import template from './button.twig';
import figma from '../../../.storybook/configma.json';
import figma from '../../.storybook/configma.json';

export default {
title: 'Components/Button',
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions src/components/card/_card.scss → components/card/_card.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use '../tokens/tokens' as *;
@use '../../src/stylesheets/mixins' as *;

.card {
display: flex;
flex-flow: column nowrap;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
35 changes: 35 additions & 0 deletions components/components.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Forward all component styles
@forward './accordion/accordion';
@forward './audio-player/audio-player';
@forward './blockquote/blockquote';
@forward './button/button';
@forward './card/card';
@forward './docs/examples/home';
@forward './docs/examples/program';
@forward './forms/checkbox/checkbox';
@forward './forms/radio/radio';
@forward './forms/select/select';
@forward './forms/textfields/textfields';
@forward './forms/fieldset';
@forward './icons/icons';
@forward './images/image/image';
@forward './links/link/link';
@forward './lists/list';
@forward './logo/logo';
@forward './menus/breadcrumbs/breadcrumbs';
@forward './menus/inline/inline-menu';
@forward './menus/main-menu/00-main-menu';
@forward './menus/main-menu/01-main-menu-item';
@forward './menus/main-menu/02-main-menu-link';
@forward './menus/main-menu/03-main-menu-toggle';
@forward './menus/social-menu/social-menu';
@forward './pager/pager';
@forward './status/status';
@forward './storybook-styles/storybook.scss';
@forward './tables/tables';
@forward './tabs/tab';
@forward './tabs/tabs';
@forward './text/headings/headings';
@forward './text/text/body';
@forward './text/text/text';
@forward './videos/video';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import template from './cover.twig';
import backgroundImage from '../../../images/cover.png';
import backgroundImage from '../../../src/images/cover.png';

const data = { backgroundImage };

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
@use '../../../stylesheets/mixins';
@use '../../tokens/tokens' as *;
@use '../../../src/stylesheets/mixins' as *;

.example {
display: flex;
flex-flow: column nowrap;
background-color: var(--colors-white);
padding: 0 !important;

// max-width: var(--max-width);
margin: 0 auto;
min-height: 100vh;
Expand Down Expand Up @@ -126,7 +128,7 @@
margin-top: auto;
display: flex;
flex-flow: row nowrap;
align-items: start;
align-items: flex-start;

.footer-content {
margin-right: auto;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use '../../tokens/tokens' as *;
@use '../../../src/stylesheets/mixins' as *;

.example {
.dynamic {
background: var(--colors-primary-lighter);
Expand Down
File renamed without changes.
29 changes: 29 additions & 0 deletions components/docs/examples/home.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import template from './home.twig';
import data from './home.yml';
import heroImage from '../../../src/images/example/hero.jpg';
import watchImage1 from '../../../src/images/example/watch-Image.png';
import watchImage2 from '../../../src/images/example/watch-Image-1.png';
import watchImage3 from '../../../src/images/example/watch-Image-2.png';
import celebratingImage1 from '../../../src/images/example/celebrating-Image-1.png';
import celebratingImage2 from '../../../src/images/example/celebrating-Image-2.png';
import celebratingImage3 from '../../../src/images/example/celebrating-Image-3.png';
import celebratingImage4 from '../../../src/images/example/celebrating-Image-4.png';

const celebratingImages = [
celebratingImage1,
celebratingImage2,
celebratingImage3,
celebratingImage4,
];
const watchImages = [watchImage1, watchImage2, watchImage3];

export default {
title: 'Pages/Home',
decorators: [
(story) =>
`<div style="background: var(--colors-grays-700); padding: 0;">${story()}</div>`,
],
};

export const Home = () =>
template({ data, heroImage, watchImages, celebratingImages });
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '../tokens/tokens' as *;

fieldset {
border: var(--border-sm) solid var(--color-fieldset-border);
border-radius: var(--radius-fieldset);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use '../../tokens/tokens' as *;
@use '../../../src/stylesheets/mixins' as *;

.form-item--checkboxes,
.form-item--checkbox__item {
@include list-reset;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use '../../tokens/tokens' as *;
@use '../../../src/stylesheets/mixins' as *;

.form-item--radios,
.form-item--radio__item {
@include list-reset;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// CSS-only select styling (from https://github.com/filamentgroup/select-css)
@use '../../tokens/tokens' as *;
@use '../../../src/stylesheets/mixins' as *;

.form-item__dropdown {
border: var(--border-sm) solid clr(accent);
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@use '../../tokens/tokens' as *;
@use '../../../src/stylesheets/breakpoints.scss' as *;
@use '../../../src/stylesheets/mixins' as *;

.form-item {
color: var(--colors-text-body);
margin-bottom: 1em;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import iconTwig from './icons.twig';

const svgIcons = require.context('../../../images/icons/', true, /\.svg$/);
const svgIcons = require.context('../../assets/icons/', true, /\.svg$/);
const icons = [];
svgIcons.keys().forEach((key) => {
const icon = key.split('./')[1].split('.')[0];
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import figure from './image/figure.twig';
import imageData from './image/image.yml';
import figureData from './image/figure.yml';

const svgIcons = require.context('../../../images/icons/', true, /\.svg$/);
const svgIcons = require.context('../../assets/icons/', true, /\.svg$/);
const icons = [];
svgIcons.keys().forEach((key) => {
const icon = key.split('./')[1].split('.')[0];
Expand Down
5 changes: 5 additions & 0 deletions components/links/link/_link.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@use '../../../src/stylesheets/mixins' as *;

.link {
@include link;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '../../src/stylesheets/mixins' as *;

ul {
@include list-reset;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '../../../src/stylesheets/mixins' as *;

.breadcrumb {
@include list-reset;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use '../../../src/stylesheets/breakpoints.scss' as *;
@use '../../../src/stylesheets/mixins' as *;

.inline-menu {
@include list-reset;

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use '../../../src/stylesheets/breakpoints.scss' as *;
@use '../../../src/stylesheets/mixins' as *;

/* Nav */
.main-nav {
display: none;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use '../../../src/stylesheets/breakpoints.scss' as *;
@use '../../../src/stylesheets/mixins' as *;

/* LI */
.main-menu__item {
border-top: 1px solid;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use '../../../src/stylesheets/breakpoints.scss' as *;
@use '../../../src/stylesheets/mixins' as *;

/* A */
.main-menu__link {
background: var(--main-menu-color-link-bg);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use '../../../src/stylesheets/breakpoints.scss' as *;
@use '../../../src/stylesheets/mixins' as *;

/* Toggle */
.toggle-expand {
@include link;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '../../../src/stylesheets/mixins' as *;

.social-menu {
@include list-reset;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use '../../src/stylesheets/breakpoints.scss' as *;
@use '../../src/stylesheets/mixins' as *;

.pager {
margin: var(--spacing-xl) 0;
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use '../../src/stylesheets/breakpoints.scss' as *;
@use '../../src/stylesheets/mixins' as *;

.status__list {
@include list-reset;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit a945408

Please sign in to comment.