-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(FieldsCombiner and TagGroup): QUV-1008 Use of styles prop, subco…
…mponents and dot notation instead of extending styled components or use 'as' prop
- Loading branch information
1 parent
d801f48
commit c67f62e
Showing
10 changed files
with
158 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { css, DefaultTheme } from 'styled-components'; | ||
|
||
import { LabelPosition } from './declarations'; | ||
import { StyledTagContainerProps } from '../Tag/components/StyledTagContainer'; | ||
|
||
export interface TagGroupLabelMixinProps | ||
extends Pick<StyledTagContainerProps, 'size'> { | ||
labelPosition: LabelPosition; | ||
theme: DefaultTheme; | ||
} | ||
|
||
/** | ||
* Get the specific styles for Label component when it's used as a TagGroup label component | ||
* | ||
* @return specific styles for Label | ||
*/ | ||
|
||
export const tagGroupLabelMixin = ({ | ||
labelPosition, | ||
size, | ||
theme, | ||
}: TagGroupLabelMixinProps) => { | ||
const tokens = theme.cmp.tagGroup.label; | ||
return css` | ||
display: flex; | ||
align-items: center; | ||
flex-shrink: 0; | ||
${labelPosition === 'left' | ||
? css` | ||
margin-right: ${tokens.space.marginRight}; | ||
` | ||
: css` | ||
margin-bottom: ${tokens.space.marginBottom[size]}; | ||
`}; | ||
`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
packages/form/src/components/FieldsCombiner/FieldsCombiner.cases.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { FieldsCombiner } from '..'; | ||
import { | ||
ElemIconButton, | ||
ElemButton, | ||
ElemSelect, | ||
ElemCheckbox, | ||
ElemInputControl, | ||
} from './__stories__/commonElements'; | ||
|
||
const meta: Meta<typeof FieldsCombiner> = { | ||
title: 'Components/Form/FieldsCombiner/cases', | ||
component: FieldsCombiner, | ||
args: { | ||
hasWideControl: true, | ||
size: 'md', | ||
status: 'base', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof FieldsCombiner>; | ||
|
||
export const InputAndButton: Story = { | ||
name: 'Input and Button', | ||
args: { | ||
id: 'fields-1', | ||
label: 'Input and Button to right', | ||
leftElem: ElemInputControl, | ||
rightElem: ElemButton, | ||
}, | ||
}; | ||
|
||
export const InputAndIconButton: Story = { | ||
name: 'Input and IconButton', | ||
args: { | ||
id: 'fields-1', | ||
label: 'Input and IconButton to right', | ||
leftElem: ElemInputControl, | ||
rightElem: ElemIconButton, | ||
}, | ||
}; | ||
|
||
export const InputAndCheckbox: Story = { | ||
name: 'Input and Checkbox', | ||
args: { | ||
id: 'fields-1', | ||
label: 'Input and Checkbox to right', | ||
leftElem: ElemInputControl, | ||
rightElem: ElemCheckbox, | ||
}, | ||
}; | ||
|
||
export const SelectAndInput: Story = { | ||
name: 'Select and Input', | ||
args: { | ||
id: 'fields-1', | ||
label: 'Select and Input to right', | ||
leftElem: ElemSelect, | ||
rightElem: ElemInputControl, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.