-
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.
add select & avatar ui component & add currency select form & other f…
…ixes
- Loading branch information
1 parent
6eb65ee
commit b8bc321
Showing
22 changed files
with
267 additions
and
7 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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
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,5 @@ | ||
.avatar { | ||
border-radius: 50%; | ||
width: 100px; | ||
height: 100px; | ||
} |
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 { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
import { Avatar } from './Avatar'; | ||
import AvatarImg from './storybook.png'; | ||
|
||
export default { | ||
title: 'shared/Avatar', | ||
component: Avatar, | ||
argTypes: { | ||
backgroundColor: { control: 'color' }, | ||
}, | ||
} as ComponentMeta<typeof Avatar>; | ||
|
||
const Template: ComponentStory<typeof Avatar> = (args) => <Avatar { ...args } />; | ||
|
||
export const Primary = Template.bind({}); | ||
Primary.args = { | ||
src: AvatarImg, | ||
size: 150, | ||
}; | ||
|
||
export const Small = Template.bind({}); | ||
Small.args = { | ||
src: AvatarImg, | ||
size: 50, | ||
}; |
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,27 @@ | ||
import React, { CSSProperties, ImgHTMLAttributes, useMemo } from 'react'; | ||
import { classNames } from 'shared/lib/classNames/classNames'; | ||
import classes from './Avatar.module.scss'; | ||
|
||
interface IAvatarProps extends ImgHTMLAttributes<HTMLImageElement> { | ||
className?: string; | ||
size?: number; | ||
} | ||
|
||
export const Avatar: React.FC<IAvatarProps> = (props) => { | ||
const { | ||
className, | ||
size, | ||
...otherProps | ||
} = props; | ||
|
||
const styles = useMemo<CSSProperties>( () => { | ||
return { | ||
width: size || 100, | ||
height: size || 100, | ||
}; | ||
}, [ size ] ); | ||
|
||
return ( | ||
<img style={ styles } alt={otherProps.alt} className={ classNames( classes.avatar, {}, [ className ] ) } { ...otherProps }/> | ||
); | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,19 @@ | ||
.select-wrapper { | ||
display: flex; | ||
align-items: center; | ||
gap: 5px; | ||
} | ||
|
||
.label {} | ||
|
||
.select { | ||
outline: none; | ||
color: var(--inverted-primary-color); | ||
background: var(--primary-color); | ||
padding: 5px; | ||
} | ||
|
||
.select-option { | ||
color: var(--inverted-primary-color); | ||
background: var(--primary-color); | ||
} |
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,32 @@ | ||
import React from 'react'; | ||
import { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
import { Select } from 'shared/ui/Select/Select'; | ||
|
||
export default { | ||
title: 'shared/Select', | ||
component: Select, | ||
argTypes: { | ||
backgroundColor: { control: 'color' }, | ||
}, | ||
} as ComponentMeta<typeof Select>; | ||
|
||
const Template: ComponentStory<typeof Select> = (args) => <Select { ...args } />; | ||
|
||
export const Primary = Template.bind({}); | ||
Primary.args = { | ||
label: 'Укажите значение', | ||
options: [ | ||
{ | ||
value: '1', | ||
text: 'Первый пункт', | ||
}, | ||
{ | ||
value: '2', | ||
text: 'Второй пункт', | ||
}, | ||
{ | ||
value: '3', | ||
text: 'Третий пункт', | ||
} | ||
] | ||
}; |
Oops, something went wrong.