Skip to content

Commit

Permalink
fix: flex props
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadPCh committed Feb 25, 2024
1 parent 749c87a commit ef7517b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@giveth/ui-design-system",
"version": "1.11.22",
"version": "1.11.23",
"files": [
"/lib"
],
Expand Down
35 changes: 26 additions & 9 deletions src/components/layout/Flex.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type CSSProperties } from 'react';
import styled from 'styled-components';
import styled, { css } from 'styled-components';

interface IFlexProps {
$flexWrap?: boolean;
Expand All @@ -11,14 +11,31 @@ interface IFlexProps {

export const Flex = styled.div<IFlexProps>`
display: flex;
flex-direction: ${props =>
props.$flexDirection ? props.$flexDirection : 'initial'};
flex-wrap: ${props => (props.$flexWrap ? 'wrap' : 'nowrap')};
align-items: ${props =>
props.$alignItems ? props.$alignItems : 'initial'};
justify-content: ${props =>
props.$justifyContent ? props.$justifyContent : 'initial'};
gap: ${props => props.gap};
${props =>
props.$flexDirection &&
css`
flex-direction: ${props.$flexDirection};
`}
${props =>
props.$flexWrap &&
css`
flex-wrap: wrap;
`}
${props =>
props.$alignItems &&
css`
align-items: ${props.$alignItems};
`}
${props =>
props.$justifyContent &&
css`
justify-content: ${props.$justifyContent};
`}
${props =>
props.gap &&
css`
gap: ${props.gap};
`}
`;

interface IFlexCenter {
Expand Down

0 comments on commit ef7517b

Please sign in to comment.