Skip to content

Commit

Permalink
Refactor KuiFlexGroup styles to use similar pattern to KuiFlexGrid. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcenizal committed Sep 19, 2017
1 parent 710775a commit f42ebcb
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 34 deletions.
28 changes: 20 additions & 8 deletions ui_framework/dist/ui_framework_theme_dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -746,14 +746,6 @@ table {
-webkit-flex-basis: 0;
-ms-flex-preferred-size: 0;
flex-basis: 0; }
.kuiFlexGroup.kuiFlexGroup--gutterSmall > .kuiFlexItem + .kuiFlexItem {
margin-left: 8px; }
.kuiFlexGroup.kuiFlexGroup--gutterMedium > .kuiFlexItem + .kuiFlexItem {
margin-left: 16px; }
.kuiFlexGroup.kuiFlexGroup--gutterLarge > .kuiFlexItem + .kuiFlexItem {
margin-left: 24px; }
.kuiFlexGroup.kuiFlexGroup--gutterExtraLarge > .kuiFlexItem + .kuiFlexItem {
margin-left: 40px; }
.kuiFlexGroup.kuiFlexGroup--flexGrowZero > .kuiFlexItem {
-webkit-box-flex: 0;
-webkit-flex-grow: 0;
Expand Down Expand Up @@ -782,6 +774,26 @@ table {
-ms-flex-pack: end;
justify-content: flex-end; }

.kuiFlexGroup--gutterSmall {
margin: -4px; }
.kuiFlexGroup--gutterSmall > .kuiFlexItem {
margin: 4px; }

.kuiFlexGroup--gutterMedium {
margin: -8px; }
.kuiFlexGroup--gutterMedium > .kuiFlexItem {
margin: 8px; }

.kuiFlexGroup--gutterLarge {
margin: -12px; }
.kuiFlexGroup--gutterLarge > .kuiFlexItem {
margin: 12px; }

.kuiFlexGroup--gutterXLarge {
margin: -20px; }
.kuiFlexGroup--gutterXLarge > .kuiFlexItem {
margin: 20px; }

@media only screen and (max-width: 768px) {
.kuiFlexGroup {
-webkit-flex-wrap: wrap;
Expand Down
28 changes: 20 additions & 8 deletions ui_framework/dist/ui_framework_theme_light.css
Original file line number Diff line number Diff line change
Expand Up @@ -746,14 +746,6 @@ table {
-webkit-flex-basis: 0;
-ms-flex-preferred-size: 0;
flex-basis: 0; }
.kuiFlexGroup.kuiFlexGroup--gutterSmall > .kuiFlexItem + .kuiFlexItem {
margin-left: 8px; }
.kuiFlexGroup.kuiFlexGroup--gutterMedium > .kuiFlexItem + .kuiFlexItem {
margin-left: 16px; }
.kuiFlexGroup.kuiFlexGroup--gutterLarge > .kuiFlexItem + .kuiFlexItem {
margin-left: 24px; }
.kuiFlexGroup.kuiFlexGroup--gutterExtraLarge > .kuiFlexItem + .kuiFlexItem {
margin-left: 40px; }
.kuiFlexGroup.kuiFlexGroup--flexGrowZero > .kuiFlexItem {
-webkit-box-flex: 0;
-webkit-flex-grow: 0;
Expand Down Expand Up @@ -782,6 +774,26 @@ table {
-ms-flex-pack: end;
justify-content: flex-end; }

.kuiFlexGroup--gutterSmall {
margin: -4px; }
.kuiFlexGroup--gutterSmall > .kuiFlexItem {
margin: 4px; }

.kuiFlexGroup--gutterMedium {
margin: -8px; }
.kuiFlexGroup--gutterMedium > .kuiFlexItem {
margin: 8px; }

.kuiFlexGroup--gutterLarge {
margin: -12px; }
.kuiFlexGroup--gutterLarge > .kuiFlexItem {
margin: 12px; }

.kuiFlexGroup--gutterXLarge {
margin: -20px; }
.kuiFlexGroup--gutterXLarge > .kuiFlexItem {
margin: 20px; }

@media only screen and (max-width: 768px) {
.kuiFlexGroup {
-webkit-flex-wrap: wrap;
Expand Down
35 changes: 18 additions & 17 deletions ui_framework/src/components/flex/_flex_group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,6 @@
flex-basis: 0;
}

// Gutter Sizes
&.kuiFlexGroup--gutterSmall > .kuiFlexItem + .kuiFlexItem {
margin-left: $kuiSizeS;
}

&.kuiFlexGroup--gutterMedium > .kuiFlexItem + .kuiFlexItem {
margin-left: $kuiSize;
}

&.kuiFlexGroup--gutterLarge > .kuiFlexItem + .kuiFlexItem {
margin-left: $kuiSizeL;
}

&.kuiFlexGroup--gutterExtraLarge > .kuiFlexItem + .kuiFlexItem {
margin-left: $kuiSizeXXL;
}

// Turn off item growth
&.kuiFlexGroup--flexGrowZero > .kuiFlexItem {
flex-grow: 0;
Expand All @@ -48,6 +31,24 @@
}
}

$gutterTypes: (
gutterSmall: $kuiSizeS,
gutterMedium: $kuiSize,
gutterLarge: $kuiSizeL,
gutterXLarge: $kuiSizeXXL,
);

@each $gutterName, $gutterSize in $gutterTypes {
$halfGutterSize: $gutterSize * 0.5;

.kuiFlexGroup--#{$gutterName} {
margin: -$halfGutterSize;

& > .kuiFlexItem {
margin: $halfGutterSize;
}
}
}

@include screenXSmall {
.kuiFlexGroup {
Expand Down
2 changes: 1 addition & 1 deletion ui_framework/src/components/flex/flex_group.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const gutterSizeToClassNameMap = {
small: 'kuiFlexGroup--gutterSmall',
medium: 'kuiFlexGroup--gutterMedium',
large: 'kuiFlexGroup--gutterLarge',
extraLarge: 'kuiFlexGroup--gutterExtraLarge',
extraLarge: 'kuiFlexGroup--gutterXLarge',
};

export const GUTTER_SIZES = Object.keys(gutterSizeToClassNameMap);
Expand Down

0 comments on commit f42ebcb

Please sign in to comment.