|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
710 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 | // flex-flow: <flex-direction> || <flex-wrap>
|
|---|
| 3 |
|
|---|
| 4 | const flexDirection = new Set([
|
|---|
| 5 | 'row',
|
|---|
| 6 | 'row-reverse',
|
|---|
| 7 | 'column',
|
|---|
| 8 | 'column-reverse',
|
|---|
| 9 | ]);
|
|---|
| 10 |
|
|---|
| 11 | const flexWrap = new Set(['nowrap', 'wrap', 'wrap-reverse']);
|
|---|
| 12 |
|
|---|
| 13 | /**
|
|---|
| 14 | * @param {import('postcss-value-parser').ParsedValue} flexFlow
|
|---|
| 15 | * @return {string}
|
|---|
| 16 | */
|
|---|
| 17 | module.exports = function normalizeFlexFlow(flexFlow) {
|
|---|
| 18 | let order = {
|
|---|
| 19 | direction: '',
|
|---|
| 20 | wrap: '',
|
|---|
| 21 | };
|
|---|
| 22 |
|
|---|
| 23 | flexFlow.walk(({ value }) => {
|
|---|
| 24 | if (flexDirection.has(value.toLowerCase())) {
|
|---|
| 25 | order.direction = value;
|
|---|
| 26 | return;
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | if (flexWrap.has(value.toLowerCase())) {
|
|---|
| 30 | order.wrap = value;
|
|---|
| 31 | return;
|
|---|
| 32 | }
|
|---|
| 33 | });
|
|---|
| 34 |
|
|---|
| 35 | return `${order.direction} ${order.wrap}`.trim();
|
|---|
| 36 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.