Skip to content

Commit

Permalink
Merge pull request #118 from emulsify-ds/fix-add-missing-components
Browse files Browse the repository at this point in the history
Feat: Update emulsify core to latest release, adjust stylint/prettier complaints
  • Loading branch information
callinmullaney authored Jul 22, 2024
2 parents 118dcbc + e2e5fca commit f0dde8a
Show file tree
Hide file tree
Showing 59 changed files with 761 additions and 643 deletions.
24 changes: 16 additions & 8 deletions components/00-base/00-defaults/_03-mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
*/

@mixin body-copy {
font-family: $font-body;
font-size: 1rem;
line-height: 1.6;
& {
font-family: $font-body;
font-size: 1rem;
line-height: 1.6;
}
}

@mixin clearfix {
Expand Down Expand Up @@ -55,15 +57,21 @@

// Mixin - Standard Margin
@mixin margin {
margin-bottom: 1em;
& {
margin-bottom: 1em;
}
}

@mixin no-bottom {
margin-bottom: 0;
& {
margin-bottom: 0;
}
}

@mixin list-reset {
list-style: none;
margin: 0;
padding: 0;
& {
list-style: none;
margin: 0;
padding: 0;
}
}
12 changes: 6 additions & 6 deletions components/00-base/01-colors/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Drupal.behaviors.displayColorDefinitions = {
* Converts a number to a two-digit hexadecimal string.
*
* @param {number} x The number to convert.
* @returns {string} Two-digit hexadecimal representation of the number.
* @return {string} Two-digit hexadecimal representation of the number.
*/
function hex(x) {
return `0${parseInt(x, 10).toString(16)}`.slice(-2);
Expand All @@ -14,21 +14,21 @@ Drupal.behaviors.displayColorDefinitions = {
* Converts an rgb color string to a hex color string.
*
* @param {string} color The RGB color string (e.g., 'rgb(255, 255, 255)').
* @returns {string} The hexadecimal color string (e.g., '#ffffff').
* @return {string} The hexadecimal color string (e.g., '#ffffff').
*/
function rgb2hex(color) {
const rgb = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
return `#${hex(rgb[1])}${hex(rgb[2])}${hex(rgb[3])}`;
}

const swatches = document.querySelectorAll('.cl-colors__item');
const swatches = document.querySelectorAll(".cl-colors__item");
if (swatches) {
swatches.forEach((swatch) => {
const color = window
.getComputedStyle(swatch.querySelector('.cl-colors__swatch'), null)
.getPropertyValue('background-color');
.getComputedStyle(swatch.querySelector(".cl-colors__swatch"), null)
.getPropertyValue("background-color");

const definition = swatch.querySelector('.cl-colors__definition');
const definition = swatch.querySelector(".cl-colors__definition");
definition.textContent = rgb2hex(color);
});
}
Expand Down
8 changes: 4 additions & 4 deletions components/00-base/01-colors/colors.stories.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import colors from './colors.twig';
import colors from "./colors.twig";

import colorsData from './colors.yml';
import './colors';
import colorsData from "./colors.yml";
import "./colors";

/**
* Storybook Definition.
*/
export default {
title: 'Base/Colors',
title: "Base/Colors",
};

export const Palettes = () => colors(colorsData);
6 changes: 3 additions & 3 deletions components/00-base/02-motion/motion.stories.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import motion from './motion.twig';
import motion from "./motion.twig";

import motionData from './motion.yml';
import motionData from "./motion.yml";

/**
* Add storybook definition for Animations.
*/
export default { title: 'Base/Motion' };
export default { title: "Base/Motion" };

export const Usage = () => motion(motionData);
4 changes: 3 additions & 1 deletion components/00-base/03-site/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ body {
.main {
@include wrapper;

display: block; /* Fix for IE weirdness */
& {
display: block;
}
}

.visually-hidden {
Expand Down
6 changes: 3 additions & 3 deletions components/00-base/04-spacing/spacing.stories.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import spacingTwig from './spacing.twig';
import spacingData from './spacing.yml';
import spacingTwig from "./spacing.twig";
import spacingData from "./spacing.yml";

export default {
title: 'Base/Spacing',
title: "Base/Spacing",
};

export const Spacing = () => spacingTwig(spacingData);
28 changes: 14 additions & 14 deletions components/01-atoms/atoms.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
@forward "./buttons/buttons";
@forward "./forms/checkbox/checkbox";
@forward "./forms/radio/radio";
@forward "./forms/select/select";
@forward "./forms/textfields/textfields";
@forward "./images/image/image";
@forward "./images/icons/icons";
@forward "./links/link/link";
@forward "./lists/list";
@forward "./tables/tables";
@forward "./text/headings/headings";
@forward "./text/text/text";
@forward "./tooltip/tooltip";
@forward "./videos/video";
@forward "buttons/buttons";
@forward "forms/checkbox/checkbox";
@forward "forms/radio/radio";
@forward "forms/select/select";
@forward "forms/textfields/textfields";
@forward "images/image/image";
@forward "images/icons/icons";
@forward "links/link/link";
@forward "lists/list";
@forward "tables/tables";
@forward "text/headings/headings";
@forward "text/text/text";
@forward "tooltip/tooltip";
@forward "videos/video";
12 changes: 8 additions & 4 deletions components/01-atoms/buttons/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,17 @@ $button-colors: (

// Button size variations
@mixin button-medium {
line-height: 1.4;
padding: $space-one-half $space;
& {
line-height: 1.4;
padding: $space-one-half $space;
}
}

@mixin button-large {
line-height: 2;
padding: $space $space-double;
& {
line-height: 2;
padding: $space $space-double;
}
}

.button {
Expand Down
8 changes: 4 additions & 4 deletions components/01-atoms/buttons/buttons.stories.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Buttons Stories
import button from './button.twig';
import button from "./button.twig";

import buttonData from './button.yml';
import buttonAltData from './button-alt.yml';
import buttonData from "./button.yml";
import buttonAltData from "./button-alt.yml";

/**
* Storybook Definition.
*/
export default { title: 'Atoms/Button' };
export default { title: "Atoms/Button" };

export const twig = () => button(buttonData);

Expand Down
16 changes: 8 additions & 8 deletions components/01-atoms/forms/forms.stories.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import checkbox from './checkbox/checkbox.twig';
import radio from './radio/radio.twig';
import select from './select/select.twig';
import textfields from './textfields/textfields.twig';
import checkbox from "./checkbox/checkbox.twig";
import radio from "./radio/radio.twig";
import select from "./select/select.twig";
import textfields from "./textfields/textfields.twig";

import checkboxData from './checkbox/checkbox.yml';
import radioData from './radio/radio.yml';
import selectOptionsData from './select/select.yml';
import checkboxData from "./checkbox/checkbox.yml";
import radioData from "./radio/radio.yml";
import selectOptionsData from "./select/select.yml";

/**
* Storybook Definition.
*/
export default { title: 'Atoms/Forms' };
export default { title: "Atoms/Forms" };

export const checkboxes = () => checkbox(checkboxData);

Expand Down
16 changes: 8 additions & 8 deletions components/01-atoms/images/images.stories.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import image from './image/responsive-image.twig';
import figure from './image/figure.twig';
import iconTwig from './icons/icons.twig';
import image from "./image/responsive-image.twig";
import figure from "./image/figure.twig";
import iconTwig from "./icons/icons.twig";

import imageData from './image/image.yml';
import figureData from './image/figure.yml';
import imageData from "./image/image.yml";
import figureData from "./image/figure.yml";

const svgIcons = require.context('../../../assets/icons/', true, /\.svg$/);
const svgIcons = require.context("../../../assets/icons/", true, /\.svg$/);
const icons = [];
svgIcons.keys().forEach((key) => {
const icon = key.split('./')[1].split('.')[0];
const icon = key.split("./")[1].split(".")[0];
icons.push(icon);
});

/**
* Storybook Definition.
*/
export default { title: 'Atoms/Images' };
export default { title: "Atoms/Images" };

export const images = () => image(imageData);

Expand Down
6 changes: 3 additions & 3 deletions components/01-atoms/links/link/links.stories.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import link from './link.twig';
import link from "./link.twig";

import linkData from './link.yml';
import linkData from "./link.yml";

/**
* Storybook Definition.
*/
export default { title: 'Atoms/Links' };
export default { title: "Atoms/Links" };

export const links = () => link(linkData);
8 changes: 6 additions & 2 deletions components/01-atoms/lists/_list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
ul {
@include list-reset;

list-style-type: disc;
& {
list-style-type: disc;
}
}

ol {
@include list-reset;

list-style-type: decimal;
& {
list-style-type: decimal;
}
}

.text-field {
Expand Down
16 changes: 8 additions & 8 deletions components/01-atoms/lists/list.stories.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import listTwig from './list.twig';
import dlTwig from './dl.twig';
import listTwig from "./list.twig";
import dlTwig from "./dl.twig";

import listData from './list.yml';
import dlData from './dl.yml';
import listData from "./list.yml";
import dlData from "./dl.yml";

/**
* Storybook Definition.
*/
export default { title: 'Atoms/Lists' };
export default { title: "Atoms/Lists" };

export const UnorderedList = () => `
<div class="text-field">
Expand All @@ -16,15 +16,15 @@ export const UnorderedList = () => `
`;
export const OrderedList = () => `
<div class="text-field">
${listTwig({ list__items: listData.ordered__list__items, list__type: 'ol' })}
${listTwig({ list__items: listData.ordered__list__items, list__type: "ol" })}
</div>
`;
export const DescriptionList = () => `
<div class="text-field">
${dlTwig({
dl__items: dlData.dl__items,
list__type: 'dl',
list__base_class: 'description',
list__type: "dl",
list__base_class: "description",
})}
</div>
`;
6 changes: 3 additions & 3 deletions components/01-atoms/tables/tables.stories.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import tableTwig from './tables.twig';
import tableData from './tables.yml';
import tableTwig from "./tables.twig";
import tableData from "./tables.yml";

/**
* Storybook Definition.
*/
export default { title: 'Atoms/Tables' };
export default { title: "Atoms/Tables" };

export const tables = () => tableTwig(tableData);
20 changes: 10 additions & 10 deletions components/01-atoms/text/text.stories.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import heading from './headings/_heading.twig';
import blockquote from './text/02-blockquote.twig';
import pre from './text/05-pre.twig';
import paragraph from './text/03-inline-elements.twig';
import code from './text/07-code.twig';
import heading from "./headings/_heading.twig";
import blockquote from "./text/02-blockquote.twig";
import pre from "./text/05-pre.twig";
import paragraph from "./text/03-inline-elements.twig";
import code from "./text/07-code.twig";

import blockquoteData from './text/blockquote.yml';
import headingData from './headings/headings.yml';
import codeData from './text/code.yml';
import blockquoteData from "./text/blockquote.yml";
import headingData from "./headings/headings.yml";
import codeData from "./text/code.yml";

/**
* Storybook Definition.
*/
export default { title: 'Atoms/Text' };
export default { title: "Atoms/Text" };

// Loop over items in headingData to show each one in the example below.
const headings = headingData.map((d) => heading(d)).join('');
const headings = headingData.map((d) => heading(d)).join("");

export const headingsExamples = () => headings;

Expand Down
Loading

0 comments on commit f0dde8a

Please sign in to comment.