-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
Added Chunk-Size edit facility (#288)
- Loading branch information
Showing
6 changed files
with
93 additions
and
3 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
26 changes: 26 additions & 0 deletions
26
apps/web/design-system/number-input/NumberInput.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,26 @@ | ||
import React from 'react'; | ||
import { ComponentStory, ComponentMeta } from '@storybook/react'; | ||
import { NumberInput } from './NumberInput'; | ||
|
||
export default { | ||
title: 'NumberInput', | ||
component: NumberInput, | ||
argTypes: { | ||
placeholder: { type: 'string' }, | ||
error: { type: 'string' }, | ||
disabled: { type: 'boolean' }, | ||
}, | ||
} as ComponentMeta<typeof NumberInput>; | ||
|
||
const Template: ComponentStory<typeof NumberInput> = (args: any) => <NumberInput {...args} />; | ||
|
||
export const Primary = Template.bind({}); | ||
Primary.args = { | ||
placeholder: 'Price', | ||
}; | ||
|
||
export const WithError = Template.bind({}); | ||
WithError.args = { | ||
placeholder: 'Price', | ||
error: 'This field is required', | ||
}; |
15 changes: 15 additions & 0 deletions
15
apps/web/design-system/number-input/NumberInput.styles.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,15 @@ | ||
import { colors } from '@config'; | ||
import { createStyles, MantineTheme } from '@mantine/core'; | ||
|
||
const getInputStyles = (theme: MantineTheme): React.CSSProperties => ({ | ||
borderRadius: 0, | ||
padding: theme.spacing.xs, | ||
// border: `1px solid ${hasError ? colors.danger : colors.StrokeSecondaryDark}`, | ||
backgroundColor: theme.colorScheme === 'dark' ? colors.BGPrimaryDark : colors.BGPrimaryLight, | ||
}); | ||
|
||
export default createStyles((theme: MantineTheme): Record<string, any> => { | ||
return { | ||
input: getInputStyles(theme), | ||
}; | ||
}); |
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,28 @@ | ||
import useStyles from './NumberInput.styles'; | ||
import { NumberInput as MantineInput, MantineSize } from '@mantine/core'; | ||
|
||
interface NumberInputProps { | ||
error?: string; | ||
register?: any; | ||
required?: boolean; | ||
size?: MantineSize; | ||
disabled?: boolean; | ||
placeholder?: string; | ||
} | ||
|
||
export function NumberInput({ size, error, required, disabled, register, placeholder }: NumberInputProps) { | ||
const { classes } = useStyles(); | ||
|
||
return ( | ||
<MantineInput | ||
size={size} | ||
error={error} | ||
required={required} | ||
disabled={disabled} | ||
classNames={classes} | ||
placeholder={placeholder} | ||
type="number" | ||
{...register} | ||
/> | ||
); | ||
} |
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 @@ | ||
export * from './NumberInput'; |
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