-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat(web): Introduce
Flex
layout component #DS-1415
- Loading branch information
1 parent
2cd0f17
commit d8fe654
Showing
4 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// 1. Use `display: grid` so the orientation of alignmentX and alignmentY does not change as it would with `flex-direction: column`. | ||
|
||
.Flex { | ||
gap: var(--spirit-space-600); | ||
} | ||
|
||
.Flex--row { | ||
display: flex; | ||
} | ||
|
||
.Flex--column { | ||
display: grid; // 1. | ||
} | ||
|
||
// TODO generate + responsive | ||
.Flex--alignmentXStretch, | ||
:where(.Flex:not([class*="Flex--alignmentX"])) { | ||
justify-content: stretch; /* Or normal? */ | ||
} | ||
|
||
.Flex--alignmentXLeft { | ||
justify-content: start; | ||
} | ||
|
||
.Flex--alignmentXCenter { | ||
justify-content: center; | ||
} | ||
|
||
.Flex--alignmentXRight { | ||
justify-content: end; | ||
} | ||
|
||
.Flex--alignmentXSpaceBetween { | ||
justify-content: space-between; | ||
} | ||
|
||
.Flex--alignmentYStretch, | ||
:where(.Flex:not([class*="Flex--alignmentY"])) { | ||
align-items: stretch; | ||
} | ||
|
||
.Flex--alignmentYTop { | ||
align-items: start; | ||
} | ||
|
||
.Flex--alignmentYCenter { | ||
align-items: center; | ||
} | ||
|
||
.Flex--alignmentYBottom { | ||
align-items: end; | ||
} | ||
|
||
.Flex--alignmentYBaseline { | ||
align-items: baseline; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
{{#> web/layout/plain }} | ||
|
||
<section class="UNSTABLE_Section"> | ||
<h2 class="docs-Heading">Row Layout</h2> | ||
<div class="docs-Stack docs-Stack--start"> | ||
|
||
<div class="Flex Flex--row"> | ||
<div class="docs-Box docs-Box--small">Item 1</div> | ||
<div class="docs-Box docs-Box--small">Item 2</div> | ||
<div class="docs-Box docs-Box--small">Item 3</div> | ||
</div> | ||
|
||
</div> | ||
</section> | ||
|
||
<section class="UNSTABLE_Section"> | ||
<h2 class="docs-Heading">Column Layout</h2> | ||
<div class="docs-Stack docs-Stack--start"> | ||
|
||
<div class="Flex Flex--column"> | ||
<div class="docs-Box docs-Box--small">Item 1</div> | ||
<div class="docs-Box docs-Box--small">Item 2</div> | ||
<div class="docs-Box docs-Box--small">Item 3</div> | ||
</div> | ||
|
||
</div> | ||
</section> | ||
|
||
<section class="UNSTABLE_Section"> | ||
<h2 class="docs-Heading">Responsive Layout</h2> | ||
<div class="docs-Stack docs-Stack--start"> | ||
|
||
<div class="Flex Flex--column Flex--tablet--row"> | ||
<div class="docs-Box docs-Box--small">Item 1</div> | ||
<div class="docs-Box docs-Box--small">Item 2</div> | ||
<div class="docs-Box docs-Box--small">Item 3</div> | ||
</div> | ||
|
||
</div> | ||
</section> | ||
|
||
<section class="UNSTABLE_Section"> | ||
<h2 class="docs-Heading">Horizontal Alignment</h2> | ||
<div class="docs-Stack docs-Stack--stretch"> | ||
|
||
<div class="Flex Flex--row Flex--alignmentXLeft"> | ||
<div class="docs-Box docs-Box--small">Item 1</div> | ||
<div class="docs-Box docs-Box--small">Item 2</div> | ||
<div class="docs-Box docs-Box--small">Item 3</div> | ||
</div> | ||
|
||
<div class="Flex Flex--row Flex--alignmentXCenter"> | ||
<div class="docs-Box docs-Box--small">Item 1</div> | ||
<div class="docs-Box docs-Box--small">Item 2</div> | ||
<div class="docs-Box docs-Box--small">Item 3</div> | ||
</div> | ||
|
||
<div class="Flex Flex--row Flex--alignmentXRight"> | ||
<div class="docs-Box docs-Box--small">Item 1</div> | ||
<div class="docs-Box docs-Box--small">Item 2</div> | ||
<div class="docs-Box docs-Box--small">Item 3</div> | ||
</div> | ||
|
||
<div class="Flex Flex--row Flex--alignmentXSpaceBetween"> | ||
<div class="docs-Box docs-Box--small">Item 1</div> | ||
<div class="docs-Box docs-Box--small">Item 2</div> | ||
<div class="docs-Box docs-Box--small">Item 3</div> | ||
</div> | ||
|
||
</div> | ||
</section> | ||
|
||
<section class="UNSTABLE_Section"> | ||
<h2 class="docs-Heading">Vertical Alignment</h2> | ||
<div class="docs-Stack docs-Stack--stretch"> | ||
|
||
<div class="Flex Flex--row Flex--alignmentYTop"> | ||
<div class="docs-Box docs-Box--small">Item 1</div> | ||
<div class="docs-Box docs-Box--small">Item 2<br />is taller</div> | ||
<div class="docs-Box docs-Box--small">Item 3</div> | ||
</div> | ||
|
||
<div class="Flex Flex--row Flex--alignmentYCenter"> | ||
<div class="docs-Box docs-Box--small">Item 1</div> | ||
<div class="docs-Box docs-Box--small">Item 2<br />is taller</div> | ||
<div class="docs-Box docs-Box--small">Item 3</div> | ||
</div> | ||
|
||
<div class="Flex Flex--row Flex--alignmentYBottom"> | ||
<div class="docs-Box docs-Box--small">Item 1</div> | ||
<div class="docs-Box docs-Box--small">Item 2<br />is taller</div> | ||
<div class="docs-Box docs-Box--small">Item 3</div> | ||
</div> | ||
|
||
<div class="Flex Flex--row Flex--alignmentYBaseline"> | ||
<div class="docs-Box docs-Box--small">Item 1</div> | ||
<div class="docs-Box docs-Box--small">Item 2<br />is taller</div> | ||
<div class="docs-Box typography-heading-small-text">Item 3 has bigger font size</div> | ||
</div> | ||
|
||
</div> | ||
</section> | ||
|
||
{{/web/layout/plain }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@forward 'Flex'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters