Skip to content

Commit

Permalink
feat: place-content property
Browse files Browse the repository at this point in the history
  • Loading branch information
Zivsteve committed Apr 26, 2021
1 parent 6d87240 commit 7e1f2f3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { boxShadowPreprocessor } from './preprocessors/box-shadow';
import { colorPreprocessor } from './preprocessors/color';
import { distancePreprocessor } from './preprocessors/distance';
import { numeralPreprocessor } from './preprocessors/numeral';
import { placeContentPreprocessor } from './preprocessors/place-content';
import type { BaseOptions, Preprocessor, Alias } from './types';

const defaultBreakpoints = [576, 768, 1200];
Expand All @@ -20,6 +21,8 @@ const defaultPreprocessors = {
borderBottomRadius: borderSideRadiusPreprocessor,

boxShadow: boxShadowPreprocessor,

placeContent: placeContentPreprocessor,
};

const defaultAliases: Alias = {
Expand Down
13 changes: 13 additions & 0 deletions src/preprocessors/place-content.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const placeContentPreprocessor = (key: string, value: any) => {
const valuesArr = typeof value === 'string' ? value.split(' ') : Array.isArray(value) ? value : [];

if (valuesArr.length) {
return {
[key]: undefined,
alignContent: valuesArr[0],
justifyContent: valuesArr[1] || valuesArr[0],
};
}

return null;
};

0 comments on commit 7e1f2f3

Please sign in to comment.