Skip to content

Commit 9de1844

Browse files
chohongmAhyoungRyu
andauthored
feat: Apply hover active, hover, active-hover effects on warning button (#909)
Fixes: [AC-961](https://sendbird.atlassian.net/browse/AC-961) ### Changelogs - Added `labelType`, and `labelColor` props to `ButtonProps` [AC-961]: https://sendbird.atlassian.net/browse/AC-961?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --------- Co-authored-by: Ahyoung Ryu <[email protected]>
1 parent 73b25a7 commit 9de1844

File tree

4 files changed

+35
-17
lines changed

4 files changed

+35
-17
lines changed

src/modules/Channel/components/MessageFeedbackModal/index.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ export default function MessageFeedbackModal(props: MessageFeedbackModalProps):
6262
<div className='sendbird-message-feedback-modal-footer__root'>
6363
{
6464
!isMobile && message?.myFeedback && selectedFeedback === message.myFeedback.rating
65-
? <Button type={ButtonTypes.WARNING} onClick={onRemove}>
66-
<Label type={LabelTypography.BUTTON_3} color={LabelColors.ERROR}>
67-
{stringSet.BUTTON__REMOVE_FEEDBACK}
68-
</Label>
65+
? <Button
66+
type={ButtonTypes.WARNING}
67+
onClick={onRemove}
68+
labelType={LabelTypography.BUTTON_3}
69+
>
70+
{stringSet.BUTTON__REMOVE_FEEDBACK}
6971
</Button>
7072
: <div/>
7173
}

src/styles/_color-themes.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ $themes: (
7878
primary--1-bg--7: var(--sendbird-light-primary-100),
7979
secondary--3-2: var(--sendbird-light-secondary-300),
8080
error--3-2: var(--sendbird-light-error-300),
81+
error--4-1: var(--sendbird-light-error-400),
8182
on-bg-4--bg-6: var(--sendbird-light-onlight-04),
8283
),
8384
dark: (
@@ -157,6 +158,7 @@ $themes: (
157158
primary--1-bg--7: var(--sendbird-dark-background-700),
158159
secondary--3-2: var(--sendbird-dark-secondary-200),
159160
error--3-2: var(--sendbird-dark-error-200),
161+
error--4-1: var(--sendbird-dark-error-100),
160162
on-bg-4--bg-6: var(--sendbird-dark-background-600),
161163
),
162164
);

src/ui/Button/index.scss

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -194,32 +194,40 @@
194194

195195
.sendbird-button__text {
196196
@include themed() {
197-
color: t(on-content-1);
197+
color: t(error--3-2);
198198
}
199199
}
200200

201201
&:hover {
202202
@include themed() {
203-
border-color: t(error-4);
203+
border-color: t(error--4-1);
204+
}
205+
.sendbird-button__text {
206+
@include themed() {
207+
color: t(error--4-1);
208+
}
204209
}
205210
}
206211

207212
&:focus {
208213
@include themed() {
209-
border-color: var(--sendbird-button-border-focus);
210-
box-shadow: 0 0 0 2px t(error-3);
214+
border-color: t(primary-3);
215+
.sendbird-button__text {
216+
@include themed() {
217+
color: t(error--3-2);
218+
}
219+
}
211220
}
212221
}
213222

214223
&:hover &:focus {
215224
@include themed() {
216-
box-shadow: 0 0 0 2px t(error-4);
217-
}
218-
}
219-
220-
&:active &:focus {
221-
@include themed() {
222-
box-shadow: 0 0 0 2px t(error-5);
225+
border-color: t(primary-3);
226+
.sendbird-button__text {
227+
@include themed() {
228+
color: t(error--4-1);
229+
}
230+
}
223231
}
224232
}
225233
}

src/ui/Button/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import './index.scss';
44
import Label, { LabelTypography, LabelColors } from '../Label';
55
import { changeTypeToClassName, changeSizeToClassName } from './utils';
66
import { ButtonTypes, ButtonSizes } from './types';
7+
import { ObjectValues } from '../../utils/typeHelpers/objectValues';
8+
import { Typography } from '../Label/types';
79

810
export interface ButtonProps {
911
className?: string | Array<string>;
@@ -12,6 +14,8 @@ export interface ButtonProps {
1214
children: string | ReactElement;
1315
disabled?: boolean;
1416
onClick?: () => void;
17+
labelType?: ObjectValues<typeof Typography>;
18+
labelColor?: ObjectValues<typeof LabelColors>;
1519
}
1620

1721
export default function Button({
@@ -21,6 +25,8 @@ export default function Button({
2125
children = 'Button',
2226
disabled = false,
2327
onClick = () => { /* noop */ },
28+
labelType = LabelTypography.BUTTON_1,
29+
labelColor = LabelColors.ONCONTENT_1,
2430
}: ButtonProps): ReactElement {
2531
const injectingClassNames = [
2632
...((Array.isArray(className)) ? className : [className]),
@@ -39,8 +45,8 @@ export default function Button({
3945
>
4046
<Label
4147
className="sendbird-button__text"
42-
type={LabelTypography.BUTTON_1}
43-
color={LabelColors.ONCONTENT_1}
48+
type={labelType}
49+
color={labelColor}
4450
>
4551
{children}
4652
</Label>

0 commit comments

Comments
 (0)