Skip to content

Commit

Permalink
feat(button): remove button variant ACTION & add a separate parameter…
Browse files Browse the repository at this point in the history
… for roundness
  • Loading branch information
undrcrxwn committed Jan 27, 2024
1 parent 94e7526 commit 6f5b695
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 24 deletions.
12 changes: 5 additions & 7 deletions src/shared/ui/button/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@
}
}

.action {
.clear {
padding: 12px 25px 12px 20px;
gap: 12px;
border-radius: 30px;
color: var(--color-gray-lighter);
background-color: transparent;

Expand All @@ -68,15 +67,14 @@
}
}

.clear {
background: transparent;
color: var(--color-white);
}

.disabled {
opacity: 0.5;
}

.fullWidth {
width: 100%;
}

.round {
border-radius: 30px;
}
4 changes: 3 additions & 1 deletion src/shared/ui/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export enum ButtonVariant {
SECONDARY = 'secondary',
CLEAR = 'clear',
INLINE = 'inline',
ACTION = 'action',
}

export enum ButtonShape {
Expand All @@ -22,6 +21,7 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
variant?: ButtonVariant;
shape?: ButtonShape;
center?: boolean;
round?: boolean;
}

export const Button = (props: ButtonProps) => {
Expand All @@ -30,6 +30,7 @@ export const Button = (props: ButtonProps) => {
variant = ButtonVariant.PRIMARY,
shape = ButtonShape.DEFAULT,
center = true,
round = false,
type,
className,
disabled,
Expand All @@ -41,6 +42,7 @@ export const Button = (props: ButtonProps) => {
[cls[variant]]: true,
[cls[shape]]: true,
[cls.center]: center,
[cls.round]: round,
};

return (
Expand Down
13 changes: 7 additions & 6 deletions src/widgets/header/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
.linksContainer {
display: flex;
gap: 35px;
margin-left: 30px;
}

.icon {
Expand All @@ -33,12 +34,6 @@
padding: 0;
justify-content: center;
border-radius: 0;

&:hover {
background: var(--color-white);
color: var(--color-black);
opacity: 1;
}
}

.logo {
Expand All @@ -59,3 +54,9 @@
}
}
}

.authorization {
display: flex;
gap: 12px;
margin-right: 12px;
}
20 changes: 14 additions & 6 deletions src/widgets/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {useUnit} from 'effector-react';
import {User} from '~/shared/api/types';
import {routes} from '~/shared/routes';
import {$user} from '~/shared/session';
import {Button, ButtonVariant, Input, Link, LinkVariant} from '~/shared/ui';
import {Button, ButtonShape, ButtonVariant, Input, Link, LinkVariant} from '~/shared/ui';
import ArrowIcon from '~/shared/ui/icon/assets/arrow.svg';

import Avatar from './assets/avatar.png';
Expand Down Expand Up @@ -35,7 +35,7 @@ export const Header = (props: HeaderProps) => {
className={cls.search}
/>

<div className={cls.linksContainer} style={{marginLeft: 40}}>
<div className={cls.linksContainer}>
<Link variant={LinkVariant.NAVIGATION} to={routes.explore}>
Explore
</Link>
Expand All @@ -52,17 +52,25 @@ export const Header = (props: HeaderProps) => {
</div>

{forceUser ?? user ? (
<div className={cls.row} style={{alignItems: 'normal'}}>
<Button className={cls.button}>
<div className={cls.row}>
<Button
variant={ButtonVariant.CLEAR}
shape={ButtonShape.EQUILATERAL}
className={cls.button}
>
<NotificationIcon />
</Button>
<img src={Avatar} alt="avatar" />
<Button className={cls.button}>
<Button
variant={ButtonVariant.CLEAR}
shape={ButtonShape.EQUILATERAL}
className={cls.button}
>
<ArrowIcon />
</Button>
</div>
) : (
<div>
<div className={cls.authorization}>
<Link to={routes.auth.signUp}>
<Button variant={ButtonVariant.PRIMARY}>Sign up</Button>
</Link>
Expand Down
12 changes: 8 additions & 4 deletions src/widgets/post/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ export const Post = memo((props: PostProps) => {
<Button
onClick={() => onReplyClicked && onReplyClicked(id)}
className={classNames(cls.hover)}
variant={ButtonVariant.ACTION}
variant={ButtonVariant.CLEAR}
round={true}
>
<ReplyIcon />
Reply
Expand All @@ -120,7 +121,8 @@ export const Post = memo((props: PostProps) => {
<Button
onClick={() => onReportClicked && onReportClicked(id)}
className={classNames(cls.hover)}
variant={ButtonVariant.ACTION}
variant={ButtonVariant.CLEAR}
round={true}
>
<ReportIcon />
Report
Expand All @@ -132,15 +134,17 @@ export const Post = memo((props: PostProps) => {
<Button
onClick={() => onLikeClicked && onLikeClicked(id)}
className={classNames(cls.react, react === 'like' && cls.active)}
variant={ButtonVariant.ACTION}
variant={ButtonVariant.CLEAR}
round={true}
>
{react === 'like' ? <LikeFillIcon /> : <LikeOutlineIcon />}
19
</Button>
<Button
onClick={() => onDisLikeClicked && onDisLikeClicked(id)}
className={classNames(cls.react, react === 'dislike' && cls.active)}
variant={ButtonVariant.ACTION}
variant={ButtonVariant.CLEAR}
round={true}
>
{react === 'dislike' ? (
<LikeFillIcon className={cls.dislike} />
Expand Down

0 comments on commit 6f5b695

Please sign in to comment.