Skip to content

Commit b55b303

Browse files
committed
fixing missing align and justify props on Code0Components
1 parent f234d09 commit b55b303

File tree

4 files changed

+40
-34
lines changed

4 files changed

+40
-34
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@code0-tech/pictor",
3-
"version": "0.2.1",
3+
"version": "0.2.3",
44
"description": "A simple template for a custom React component library",
55
"scripts": {
66
"dev": "npm run storybook:dev",

src/utils/types.ts

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,39 @@ export interface Code0ComponentProps {
2525
pb?: StyleProp<number | `${number}`>
2626
pl?: StyleProp<number | `${number}`>
2727
pr?: StyleProp<number | `${number}`>
28-
bg?: React.CSSProperties['backgroundColor'];
29-
c?: React.CSSProperties['color'];
30-
opacity?: React.CSSProperties['opacity'];
31-
ff?: StyleProp<'mono' | 'text' | 'heading' | (string & {})>;
32-
fz?: StyleProp<Code0FontSizes | number | `${number}`>;
33-
fw?: StyleProp<React.CSSProperties['fontWeight']>;
34-
lts?: StyleProp<React.CSSProperties['letterSpacing']>;
35-
ta?: StyleProp<React.CSSProperties['textAlign']>;
36-
lh?: StyleProp<number | (string & {})>;
37-
fs?: StyleProp<React.CSSProperties['fontStyle']>;
38-
tt?: StyleProp<React.CSSProperties['textTransform']>;
39-
td?: StyleProp<React.CSSProperties['textDecoration']>;
40-
w?: StyleProp<React.CSSProperties['width']>;
41-
miw?: StyleProp<React.CSSProperties['minWidth']>;
42-
maw?: StyleProp<React.CSSProperties['maxWidth']>;
43-
h?: StyleProp<React.CSSProperties['height']>;
44-
mih?: StyleProp<React.CSSProperties['minHeight']>;
45-
mah?: StyleProp<React.CSSProperties['maxHeight']>;
46-
bgsz?: StyleProp<React.CSSProperties['backgroundSize']>;
47-
bgp?: StyleProp<React.CSSProperties['backgroundPosition']>;
48-
bgr?: StyleProp<React.CSSProperties['backgroundRepeat']>;
49-
bga?: StyleProp<React.CSSProperties['backgroundAttachment']>;
50-
pos?: StyleProp<React.CSSProperties['position']>;
51-
top?: StyleProp<React.CSSProperties['top']>;
52-
left?: StyleProp<React.CSSProperties['left']>;
53-
bottom?: StyleProp<React.CSSProperties['bottom']>;
54-
right?: StyleProp<React.CSSProperties['right']>;
55-
inset?: StyleProp<React.CSSProperties['inset']>;
56-
display?: StyleProp<React.CSSProperties['display']>;
57-
flex?: StyleProp<React.CSSProperties['flex']>;
28+
bg?: React.CSSProperties['backgroundColor']
29+
c?: React.CSSProperties['color']
30+
opacity?: React.CSSProperties['opacity']
31+
ff?: StyleProp<'mono' | 'text' | 'heading' | (string & {})>
32+
fz?: StyleProp<Code0FontSizes | number | `${number}`>
33+
fw?: StyleProp<React.CSSProperties['fontWeight']>
34+
lts?: StyleProp<React.CSSProperties['letterSpacing']>
35+
ta?: StyleProp<React.CSSProperties['textAlign']>
36+
lh?: StyleProp<number | (string & {})>
37+
fs?: StyleProp<React.CSSProperties['fontStyle']>
38+
tt?: StyleProp<React.CSSProperties['textTransform']>
39+
td?: StyleProp<React.CSSProperties['textDecoration']>
40+
w?: StyleProp<React.CSSProperties['width']>
41+
miw?: StyleProp<React.CSSProperties['minWidth']>
42+
maw?: StyleProp<React.CSSProperties['maxWidth']>
43+
h?: StyleProp<React.CSSProperties['height']>
44+
mih?: StyleProp<React.CSSProperties['minHeight']>
45+
mah?: StyleProp<React.CSSProperties['maxHeight']>
46+
bgsz?: StyleProp<React.CSSProperties['backgroundSize']>
47+
bgp?: StyleProp<React.CSSProperties['backgroundPosition']>
48+
bgr?: StyleProp<React.CSSProperties['backgroundRepeat']>
49+
bga?: StyleProp<React.CSSProperties['backgroundAttachment']>
50+
pos?: StyleProp<React.CSSProperties['position']>
51+
top?: StyleProp<React.CSSProperties['top']>
52+
left?: StyleProp<React.CSSProperties['left']>
53+
bottom?: StyleProp<React.CSSProperties['bottom']>
54+
right?: StyleProp<React.CSSProperties['right']>
55+
inset?: StyleProp<React.CSSProperties['inset']>
56+
display?: StyleProp<React.CSSProperties['display']>
57+
flex?: StyleProp<React.CSSProperties['flex']>
58+
align?: StyleProp<React.CSSProperties['alignItems']>
59+
justify?: StyleProp<React.CSSProperties['justifyContent']>
60+
tf?: StyleProp<React.CSSProperties['transform']>
5861
}
5962

6063
export interface Code0Component<T> extends Code0ComponentProps, HTMLProps<T> {

src/utils/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,17 @@ const createStyle = (styles: Code0Component<any>): CSSProperties => ({
7171
...(styles.right ? {right: styles.right} : {}),
7272
...(styles.display ? {display: styles.display} : {}),
7373
...(styles.flex ? {flex: styles.flex} : {}),
74+
...(styles.align ? {alignItems: styles.align} : {}),
75+
...(styles.justify ? {justifyContent: styles.justify} : {}),
76+
...(styles.tf ? {transform: styles.tf} : {}),
7477

7578
})
7679

7780
export const mergeCode0Props = <T extends HTMLElement>(cn: string, rest: Code0Component<T>): HTMLProps<T> => {
7881

7982
const style = createStyle(rest)
8083
const newProps: Code0Component<T> = rest;
81-
const keys: (keyof Code0ComponentProps)[] = ["m", "my", "mx", "mt", "mb", "ml", "mr", "p", "py", "px", "pt", "pb", "pl", "pr", "bg", "c", "opacity", "ff", "fz", "fw", "lts", "ta", "lh", "fs", "tt", "td", "w", "miw", "maw", "h", "mih", "mah", "bgsz", "bgp", "bgr", "bga", "pos", "top", "left", "bottom", "right", "inset", "display", "flex"]
84+
const keys: (keyof Code0ComponentProps)[] = ["m", "my", "mx", "mt", "mb", "ml", "mr", "p", "py", "px", "pt", "pb", "pl", "pr", "bg", "c", "opacity", "ff", "fz", "fw", "lts", "ta", "lh", "fs", "tt", "td", "w", "miw", "maw", "h", "mih", "mah", "bgsz", "bgp", "bgr", "bga", "pos", "top", "left", "bottom", "right", "inset", "display", "flex", "align", "justify", "tf"]
8285

8386
keys.forEach(key => {
8487
delete newProps[key]

0 commit comments

Comments
 (0)