This repository was archived by the owner on Apr 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +16
-7
lines changed Expand file tree Collapse file tree 4 files changed +16
-7
lines changed Original file line number Diff line number Diff line change 13
13
"registry" : " https://registry.npmjs.org" ,
14
14
"access" : " public"
15
15
},
16
- "peerDependencies " : {
17
- "styled-components" : " >5 "
16
+ "dependencies " : {
17
+ "styled-components" : " ^5.3.3 "
18
18
},
19
19
"devDependencies" : {
20
20
"styled-components" : " ^5.3.3" ,
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import type {
11
11
export type CommonSpaceNumber = 2 | 4 | 8 | 12 | 16 | 24 ;
12
12
13
13
export interface IFlexbox {
14
+ horizontal ?: boolean ;
14
15
direction ?: FlexDirection ;
15
16
distribution ?: ContentDistribution ;
16
17
align ?: ContentPosition ;
@@ -28,7 +29,7 @@ export const Flexbox: FC<FlexboxProps> = styled.div.attrs(() => ({
28
29
} ) ) < IFlexbox > `
29
30
display: flex;
30
31
flex-direction: ${ ( props ) => {
31
- return getFlexDirection ( props . direction ) ;
32
+ return getFlexDirection ( props . direction , props . horizontal ) ;
32
33
} } ;
33
34
justify-content: ${ ( props ) => props . distribution } ;
34
35
align-items: ${ ( props ) => props . align } ;
@@ -40,8 +41,10 @@ export const Flexbox: FC<FlexboxProps> = styled.div.attrs(() => ({
40
41
41
42
> *:not(:last-child) {
42
43
margin-right: ${ ( props ) =>
43
- getFlexDirection ( props . direction ) === 'row' && calcValue ( props . gap ) } ;
44
+ getFlexDirection ( props . direction , props . horizontal ) === 'row' &&
45
+ calcValue ( props . gap ) } ;
44
46
margin-bottom: ${ ( props ) =>
45
- getFlexDirection ( props . direction ) === 'column' && calcValue ( props . gap ) } ;
47
+ getFlexDirection ( props . direction , props . horizontal ) === 'column' &&
48
+ calcValue ( props . gap ) } ;
46
49
}
47
50
` ;
Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ export type ContentPosition =
4
4
| 'flex-end'
5
5
| 'flex-start'
6
6
| 'start'
7
- | 'stretch' ;
7
+ | 'stretch'
8
+ | 'baseline' ;
8
9
9
10
export type ContentDistribution =
10
11
| 'center'
Original file line number Diff line number Diff line change 1
1
import type { FlexDirection } from './type' ;
2
2
3
- export const getFlexDirection = ( direction : FlexDirection ) => {
3
+ export const getFlexDirection = (
4
+ direction : FlexDirection ,
5
+ isHorizontal : boolean ,
6
+ ) => {
7
+ if ( isHorizontal ) return 'row' ;
8
+
4
9
switch ( direction ) {
5
10
case 'horizontal' :
6
11
return 'row' ;
You can’t perform that action at this time.
0 commit comments