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

React: Add Standard Accordion Components to Mayflower React #85

Merged
merged 42 commits into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
c1fc5fa
wip
avrilpearl Jul 23, 2018
6d16d67
refactor accordion item
avrilpearl Jul 23, 2018
5e556b5
revert css build and watch changes
avrilpearl Jul 23, 2018
cd0fe23
add accordion wrapper doc
avrilpearl Jul 23, 2018
7b1bc7b
fix lint errors
avrilpearl Jul 23, 2018
6edcc66
Revert "fix lint errors"
avrilpearl Jul 24, 2018
cb82691
update collapse animation
avrilpearl Jul 24, 2018
3408499
fix collapse lint error wip
avrilpearl Jul 24, 2018
88b903d
fix lint error svgcirclechevron
avrilpearl Jul 24, 2018
eabbd2f
fix accordionitem lint errors
avrilpearl Jul 24, 2018
21eebc6
fix accordion wrapper lint errors
avrilpearl Jul 24, 2018
abcd6f1
fix lint warnings
avrilpearl Jul 24, 2018
4c2c9fc
add credit note to collapse component
avrilpearl Jul 24, 2018
6257259
add new components to export
avrilpearl Jul 24, 2018
b867066
add comment relating to children props of Accordion Components
avrilpearl Jul 24, 2018
b445289
add secondary accordion style
avrilpearl Aug 20, 2018
1ff066c
add secondary accordion to mayflower-react
avrilpearl Aug 20, 2018
4ea3cc0
fix lint errors
avrilpearl Aug 20, 2018
618d522
add valid element check
avrilpearl Aug 20, 2018
d6cd2a8
Merge branch 'develop' into react-add-accordion-to-mayflower-react
avrilpearl Aug 20, 2018
27eaaf9
Merge branch 'master' into react-add-accordion-to-mayflower-react
avrilpearl Aug 20, 2018
baf6410
update from master, import global
avrilpearl Aug 20, 2018
7d20435
update screenshot
clairesunstudio Aug 20, 2018
e046816
scss clean up
clairesunstudio Aug 20, 2018
4b4bf10
add changelog
avrilpearl Aug 20, 2018
e05c691
Merge branch 'react-add-accordion-to-mayflower-react' of github.com:m…
clairesunstudio Aug 20, 2018
9b0fd9f
move scss into asset level
avrilpearl Aug 21, 2018
1c44f28
move accordion wrapper scss to asset level
avrilpearl Aug 21, 2018
6a42513
Merge branch 'develop' into react-add-accordion-to-mayflower-react
avrilpearl Aug 21, 2018
a9a3d09
allow any child to be passed to accordion item
avrilpearl Aug 21, 2018
4bd77ca
update accordion wrapper story
avrilpearl Aug 21, 2018
a9ec4e3
add accordion references, do not run vr on animations
avrilpearl Aug 21, 2018
a88ef70
remove import
avrilpearl Aug 21, 2018
ec3a81f
fix vr issues
avrilpearl Aug 21, 2018
9ace6d1
update changelog
avrilpearl Aug 21, 2018
999103b
fix accordion item story
avrilpearl Aug 22, 2018
a162cbb
add classnames dependency, update accordion item classname logic
avrilpearl Aug 22, 2018
f45bc83
move list components out of react backstop
avrilpearl Aug 22, 2018
19cb84a
remove unuse const
clairesunstudio Aug 22, 2018
fabba8a
remove fs from backstop
avrilpearl Aug 22, 2018
5097ef4
Merge branch 'react-add-accordion-to-mayflower-react' of https://gith…
avrilpearl Aug 22, 2018
6d62db7
remove eslint disable
avrilpearl Aug 22, 2018
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
176 changes: 176 additions & 0 deletions assets/scss/02-molecules/_accordion-item.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
.ma__accordion {

&-item {
border: 2px solid $c-gray-dcdcdc;
&--borderless{
border: none;
}
&--secondary{
.ma__accordion-content__body {
padding-left: 35px;
}
}
}

&-header {

&__icon--secondary {
font-size: 2.5rem;
line-height: .65em;
position: absolute;
left: 5px;
top: 5px;
text-align: center;
overflow: hidden;
transform-origin: center center;
transition: transform .2s ease;
fill: $c-theme-secondary;
transform: rotate(-90deg);
}

&__icon--secondary + &__title--secondary {
padding-left: 0px;
}

&__button {
border: none;
display: block;
padding: 20px 40px;
position: relative;
text-align: left;
width: 100%;
background-color: $c-bg-section;

&--secondary {
display: block;
position: relative;
width: 100%;
text-align: left;
border: none;
padding-left: 35px;
&.is-open {
.ma__accordion-header__icon--secondary {
transform: rotate(0deg);
}
}
}

/* focus specific transitions */
-webkit-transition: border-color .15s ease-in-out, -webkit-box-shadow .15s ease-in-out;
transition: border-color .15s ease-in-out, -webkit-box-shadow .15s ease-in-out;
-o-transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;


&:focus{
-webkit-box-shadow: 0 0 0 2px #9bdaf1;
box-shadow: 0 0 0 2px #9bdaf1;
}
&--trans {
&.is-open {
background-color: transparent;
}
}
&--solid {
&.is-open {
margin-bottom: 22px;
border-bottom: 2px solid $c-gray-dcdcdc;
}
}
&.is-open {
&:focus{
-webkit-box-shadow: 0 0 0 1px #9bdaf1;
box-shadow: 0 0 0 1px #9bdaf1;
}
&:after{
transform: rotate(135deg);
}
}

&:after {
font-size: 2.5rem;
content: "+";
line-height: .65em;
overflow: hidden;
position: absolute;
right: 15px;
top: 25px;
transform-origin: center center;
transition: transform .2s ease;
color: $c-theme-secondary;
}
}

&__icon {
position: absolute;
top: 25px;
left: 20px;
text-align: center;

& > svg {
height: 25px;
width: 25px;
fill: $c-theme-secondary;
}
}

&__title {
@include ma-h5;
font-weight: 700;
margin-bottom: 0;
min-height: 32px;
&--secondary {
font-weight: 500;
@include ma-h5;
margin-bottom: 0;
}
}

&__icon + &__title {
padding-left: 20px;
}
}

&-content {

&__body{

padding-left: 60px;
padding-right: 40px;

&.collapsed {
visibility: hidden;
height: 0px;
}

&.collapsing, &.expanding {
position: relative;
overflow: hidden;
visibility: visible;
-webkit-transition-property: height, visibility;
transition-property: height, visibility;
transition-duration: 0.35s;
-webkit-transition-duration: 0.35s;
transition-timing-function: ease;
-webkit-transition-timing-function: ease;
}

&.expanded {
height: auto;
visibility: visible;
display: block;
}

&--without-icon {
padding-left: 40px;
}

& > * {
margin-top: 1em;
}

& > :first-child {
margin-top: 0;
}
}
}
}
8 changes: 8 additions & 0 deletions assets/scss/03-organisms/_accordion-wrapper.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.ma__accordion-wrapper {
.ma__accordion-item {
margin-top: 20px;
}
.ma__accordion-item:first-child {
margin-top: 0px;
}
}
22 changes: 22 additions & 0 deletions changelogs/DP-9981.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
___DESCRIPTION___
Minor
(React) DP-9981: Adds standard accordion components and functionality to Mayflower-React. Also fixes VR bug related to react components.

Added
1. Adds AccordionItem molecule with secondary, borderless, emphasized, and subtle variants.
2. Adds AccordionWrapper organism to Mayflower React, which is a dumb wrapper for styling grouped AccordionItems.
3. Adds Collapse animation atom to Mayflower React based off of the Bootstrap React animation.
4. Adds dependency to react-transition-group for Collapse animation atom.
5. Add the SvgCircleChevron icon atom to Mayflower-React.
6. Adds dependency to classnames for simplifying conditional classname set up. Other component should be refactored to leverage this new package dependency as a follow up.

Changed
1. Changes heading atom in Mayflower React, adding the option to pass a classname to a heading component.

Fixed
1. Fixes issues related to visual regression of react components without a story and with nested variants.

___POST DEPLOY STEPS___
1. New Mayflower-React - npm install required


12 changes: 7 additions & 5 deletions react/backstop/backstop.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const listDirs = require('./listDirs');
const listComponents = require('./listComponents');
const storyBookBackstop = require('./storyBookBackstop');
const path = require('path');

Expand All @@ -10,9 +10,11 @@ let viewports;

// Scan for component names and set up viewports.
const componentsPath = `${__dirname}/../src/components/`;
testComponents = listComponents(componentsPath);

if (processAtoms) {
testId = 'mayflower-react-atoms';
components = listDirs(componentsPath)
components = testComponents
// Component directory names are capitalized.
.filter((filePath) => (/^[A-Z]/.test(path.basename(filePath))))
// Only test atoms with this backstop configuration.
Expand All @@ -27,11 +29,11 @@ if (processAtoms) {
}];
} else {
testId = 'mayflower-react';
components = listDirs(componentsPath)
components = testComponents
// Component directory names are capitalized.
.filter((filePath) => (/^[A-Z]/.test(path.basename(filePath))))
// Only test stories other than atoms with this backstop configuration.
.filter((filePath) => (filePath.indexOf('/atoms/') === -1));
// Only test stories other than atoms with this backstop configuration. Do not test animations.
.filter((filePath) => (filePath.indexOf('/atoms/') === -1) && (filePath.indexOf('/animations/') === -1));

viewports = [{
label: 'phone',
Expand Down
Binary file added react/backstop/data/.DS_Store
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions react/backstop/listComponents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

const fs = require('fs');
const path = require('path');

/**
* Lists all directories in the passed path as absolute path names.
* @param {string} dir
*/
const listComponents = (dir) => {
const fileNames = fs.readdirSync(dir);
let dirList = [];
let testList = [];

fileNames.forEach((fileName) => {
const absFilePath = path.join(dir, fileName);
if (fs.statSync(absFilePath).isDirectory()) {
dirList.push(absFilePath);
dirList = dirList.concat(listComponents(absFilePath));
}
});

Object.values(dirList).forEach((component) => {
const testComponent = fs.readdirSync(component);
testComponent.forEach((fileName) => {
if (/stories/.test(fileName)) {
testList.push(component);
}
});
})

return testList;
};

module.exports = listComponents;
24 changes: 0 additions & 24 deletions react/backstop/listDirs.js

This file was deleted.

Loading