Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rearranges app in preparation for rerelease #5

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
41 changes: 41 additions & 0 deletions app/clone-gridless.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Clone / System SCSS

// Core
@import "core/clone";

// Properties
@import "properties/alignment/alignment";
@import "properties/background-colors/background-colors";
@import "properties/borders/borders";
@import "properties/display/display";
@import "properties/fonts/fonts";
@import "properties/hover-colors/hover-colors";
@import "properties/margins/margins";
@import "properties/padding/padding";
@import "properties/radius/radius";
@import "properties/visibility/visibility";

// Components
@import "components/accordions/accordions";
@import "components/alerts/alerts";
@import "components/blockquotes/blockquotes";
@import "components/buttons/buttons";
@import "components/cards/cards";
@import "components/carousels/carousels";
@import "components/code-blocks/code-blocks";
@import "components/containers/containers";
@import "components/dialogs/dialogs";
// @import "components/flexbox-grid/flexbox-grid";
@import "components/form-elements/form-elements";
@import "components/horizontal-rules/horizontal-rules";
@import "components/iframes/iframes";
@import "components/overlays/overlays";
@import "components/pullquotes/pullquotes";
@import "components/skip-to-content-links/skip-to-content-links";
@import "components/tables/tables";
@import "components/tags/tags";

// Patterns
@import "patterns/breadcrumbs/breadcrumbs";
@import "patterns/menus/menus";
@import "patterns/sidebars/sidebars";
41 changes: 41 additions & 0 deletions app/clone.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Clone / System SCSS

// Core
@import "core/clone";

// Properties
@import "properties/alignment/alignment";
@import "properties/background-colors/background-colors";
@import "properties/borders/borders";
@import "properties/display/display";
@import "properties/fonts/fonts";
@import "properties/hover-colors/hover-colors";
@import "properties/margins/margins";
@import "properties/padding/padding";
@import "properties/radius/radius";
@import "properties/visibility/visibility";

// Components
@import "components/accordions/accordions";
@import "components/alerts/alerts";
@import "components/blockquotes/blockquotes";
@import "components/buttons/buttons";
@import "components/cards/cards";
@import "components/carousels/carousels";
@import "components/code-blocks/code-blocks";
@import "components/containers/containers";
@import "components/dialogs/dialogs";
@import "components/flexbox-grid/flexbox-grid";
@import "components/form-elements/form-elements";
@import "components/horizontal-rules/horizontal-rules";
@import "components/iframes/iframes";
@import "components/overlays/overlays";
@import "components/pullquotes/pullquotes";
@import "components/skip-to-content-links/skip-to-content-links";
@import "components/tables/tables";
@import "components/tags/tags";

// Patterns
@import "patterns/breadcrumbs/breadcrumbs";
@import "patterns/menus/menus";
@import "patterns/sidebars/sidebars";
121 changes: 121 additions & 0 deletions app/components/accordions/_accordions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// Clone / Components / Accordions

[data-clone] {

[data-c-accordion-group] {
[data-c-accordion="accordion"],
[data-c-accordion=""],
[data-c-accordion="true"] {
[data-c-accordion="trigger"],
[data-c-accordion-trigger] {
background: none;
border: none;
cursor: pointer;
padding-right: 5rem;
position: relative;
text-align: left;
width: 100%;

// Old
[data-c-accordion*="icon"] {
font-size: $clone-font-scale-h4;
position: absolute;
top: 50%;
right: 2rem;
transform: translate(0, -50%);
&[data-c-accordion*="--add"] {
display: block;
}
&[data-c-accordion*="--remove"] {
display: none;
}
}

// New
[data-c-accordion-add] {
display: block;
position: absolute;
top: 50%;
right: 2rem;
transform: translate(0, -50%);
}
[data-c-accordion-remove] {
display: none;
position: absolute;
top: 50%;
right: 2rem;
transform: translate(0, -50%);
}
@each $key, $value in $clone-color-map {
@each $alpha in $clone-opacity-list {
$newValue: unquote($key)+"("+$alpha+")";
&[data-c-background="#{$newValue}"] {
$decimal: $alpha / 100;
background: rgba($value, $decimal)
}
}
}

}
[data-c-accordion="content"],
[data-c-accordion-content] {
display: none;
form {
padding-bottom: 0;
}
}

// States
&.active {
[data-c-accordion="trigger"],
[data-c-accordion-trigger] {

// Old
[data-c-accordion*="icon"] {
&[data-c-accordion*="--add"] {
display: none;
}
&[data-c-accordion*="--remove"] {
display: block;
}
}

// New
[data-c-accordion-add] {
display: none;
}
[data-c-accordion-remove] {
display: block;
}

}
[data-c-accordion="content"],
[data-c-accordion-content] {
display: block;
}
}

[data-c-accordion="trigger"]:focus,
[data-c-accordion-trigger]:focus {
outline: $clone-focus-color solid 3px;
}
}
}

// Groupt w/ Alternating Backgrounds
[data-c-accordion="group(alt)"] {
[data-c-accordion="accordion"] {
&:nth-child(odd) {
background: $clone-accordion-alternating-background-color;
}
}
}
[data-c-accordion-group="alt"] {
[data-c-accordion] {
&:nth-child(odd) {
background: $clone-accordion-alternating-background-color;
}
}
}

}
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<!-- Accordion Group -->
<!-- Multiple accordion elements can be placed within the group element. -->
<div data-c-accordion-group>
<!-- Accordion -->
<!-- Accordion Component -->
<div data-c-accordion>
<button aria-expanded="false" data-c-accordion-trigger tabindex="0" type="button">
<div data-c-padding="all(1)">
<div data-c-padding="base(all, 1)">
<!-- Title -->
<p data-c-font-weight="bold">Accordion Title</p>
<p data-c-font-weight="base(bold)">Accordion Title</p>
<!-- Optional Subtitle -->
<p data-c-margin="top(.25)" data-c-colour="c1">Accordion Subtitle</p>
<p data-c-margin="base(top, .25)" data-c-color="base(c1)">Accordion Subtitle</p>
</div>
<span data-c-visibility="invisible">Click to view...</span>
<i aria-hidden="true" data-c-accordion-add data-c-colour="c1" data-c-font-size="h3" data-c-font-weight="bold">+</i>
<i aria-hidden="true" data-c-accordion-remove data-c-colour="c1" data-c-font-size="h3" data-c-font-weight="bold">-</i>
<span data-c-visibility="base(invisible)">Click to view...</span>
<i aria-hidden="true" data-c-accordion-add data-c-color="base(c1)" data-c-font-size="base(h3)" data-c-font-weight="base(bold)">+</i>
<i aria-hidden="true" data-c-accordion-remove data-c-color="base(c1)" data-c-font-size="base(h3)" data-c-font-weight="base(bold)">-</i>
</button>
<div aria-hidden="true" data-c-accordion-content data-c-padding="rl(1)">
<div data-c-padding="bottom(1)">
<!-- Accordion Content -->
<div aria-hidden="true" data-c-accordion-content data-c-padding="base(rl, 1)">
<div data-c-padding="base(bottom, 1)">
<!-- Content -->
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Autem atque ad quos placeat quidem earum corrupti? Ad, distinctio, maxime quasi illum ex consectetur necessitatibus et soluta quo sit ratione maiores.</p>
</div>
</div>
Expand Down
88 changes: 88 additions & 0 deletions app/components/accordions/accordions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Clone / Components / Accordions

// Old
function accordionTriggerOld(trigger) {
var accordion = "[data-c-accordion='trigger']";
var content = "[data-c-accordion='content']";
if ($(trigger).parent(accordion).hasClass("active")) {
$(trigger).attr("aria-expanded", "false");
$(trigger).parent(accordion).removeClass("active");
$(trigger).parent(accordion).find(content).attr("aria-hidden", "true");
}
else {
$(trigger).attr("aria-expanded", "true");
$(trigger).parent(accordion).addClass("active");
$(trigger).parent(accordion).find(content).attr("aria-hidden", "false");
var siblingContent = $(trigger).siblings(content);
var focusableItems = focusable(siblingContent);
var firstFocusableItem = $(focusableItems).first();
if (focusableItems.length != 0) {
firstFocusableItem[0].focus();
}
}
}

$(document).ready(function () {
$(document).on("click", "[data-c-accordion='trigger']", function (e) {
e.preventDefault();
accordionTriggerOld(this);
});
});

// New (Empty Attribute)
function accordionTrigger(trigger) {
var accordion = "[data-c-accordion='']";
var content = "[data-c-accordion-content]";
if ($(trigger).parent(accordion).hasClass("active")) {
$(trigger).attr("aria-expanded", "false");
$(trigger).parent(accordion).removeClass("active");
$(trigger).parent(accordion).find(content).attr("aria-hidden", "true");
}
else {
$(trigger).attr("aria-expanded", "true");
$(trigger).parent(accordion).addClass("active");
$(trigger).parent(accordion).find(content).attr("aria-hidden", "false");
var siblingContent = $(trigger).siblings(content);
var focusableItems = focusable(siblingContent);
var firstFocusableItem = $(focusableItems).first();
if (focusableItems.length != 0) {
firstFocusableItem[0].focus();
}
}
}

$(document).ready(function () {
$(document).on("click", "[data-c-accordion-trigger]", function (e) {
e.preventDefault();
accordionTrigger(this);
});
});

// New (React Fix)
function accordionTriggerReact(trigger) {
var accordion = "[data-c-accordion='true']";
var content = "[data-c-accordion-content]";
if ($(trigger).parent(accordion).hasClass("active")) {
$(trigger).attr("aria-expanded", "false");
$(trigger).parent(accordion).removeClass("active");
$(trigger).parent(accordion).find(content).attr("aria-hidden", "true");
}
else {
$(trigger).attr("aria-expanded", "true");
$(trigger).parent(accordion).addClass("active");
$(trigger).parent(accordion).find(content).attr("aria-hidden", "false");
var siblingContent = $(trigger).siblings(content);
var focusableItems = focusable(siblingContent);
var firstFocusableItem = $(focusableItems).first();
if (focusableItems.length != 0) {
firstFocusableItem[0].focus();
}
}
}

$(document).ready(function () {
$(document).on("click", "[data-c-accordion-trigger]", function (e) {
e.preventDefault();
accordionTriggerReact(this);
});
});
Loading