Skip to content

Commit 8342bf0

Browse files
authored
Improves the styling of the ListItem component based on whether it is interactive or not (#2501)
<!-- How to write a good PR title: - Follow [the Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). - Give as much context as necessary and as little as possible - Prefix it with [WIP] while it’s a work in progress --> ## Self Checklist - [x] I wrote a PR title in **English** and added an appropriate **label** to the PR. - [x] I wrote the commit message in **English** and to follow [**the Conventional Commits specification**](https://www.conventionalcommits.org/en/v1.0.0/). - [x] I [added the **changeset**](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) about the changes that needed to be released. (or didn't have to) - [x] I wrote or updated **documentation** related to the changes. (or didn't have to) - [x] I wrote or updated **tests** related to the changes. (or didn't have to) - [x] I tested the changes in various browsers. (or didn't have to) - Windows: Chrome, Edge, (Optional) Firefox - macOS: Chrome, Edge, Safari, (Optional) Firefox ## Related Issue <!-- Please link to issue if one exists --> <!-- Fixes #0000 --> ## Summary <!-- Please brief explanation of the changes made --> Improves the styling of the `ListItem` component based on whether it is interactive or not ## Details <!-- Please elaborate description of the changes --> - `onClick` 여부에 따라 커서, 호버 스타일을 차등 적용합니다. - `disabled` 상태의 커서를 기본값이 아니라, 다른 컴포넌트와 마찬가지로 `not-allowed` 를 사용하도록 변경합니다. ### Breaking change? (Yes/No) <!-- If Yes, please describe the impact and migration path for users --> No ## References <!-- Please list any other resources or points the reviewer should be aware of -->
1 parent af4bdd9 commit 8342bf0

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

.changeset/long-hornets-grin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@channel.io/bezier-react': patch
3+
---
4+
5+
Improves the styling of the `ListItem` component based on whether it is interacted with or not.

packages/bezier-react/src/components/ListItem/ListItem.module.scss

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
}
44

55
.ListItem {
6-
cursor: pointer;
7-
86
overflow: hidden;
97
display: flex;
108
align-items: center;
@@ -43,12 +41,16 @@
4341
border-radius: var(--radius-12);
4442
}
4543

44+
&:where(.clickable) {
45+
cursor: pointer;
46+
}
47+
4648
&:where(.disabled) {
47-
cursor: default;
49+
cursor: not-allowed;
4850
opacity: var(--opacity-disabled);
4951
}
5052

51-
&:where(:not(.disabled, .active)) {
53+
&:where(.clickable:not(.disabled, .active)) {
5254
&:where(.focused, :focus-visible) {
5355
background-color: var(--bg-black-lighter);
5456
}

packages/bezier-react/src/components/ListItem/ListItem.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const ListItem = forwardRef<ListItemRef, ListItemProps>(
4949
},
5050
forwardedRef
5151
) {
52+
const clickable = !isNil(onClick)
5253
const isLink = !isEmpty(href)
5354
const Comp = isLink ? 'a' : ((as ?? 'div') as 'div')
5455

@@ -67,6 +68,7 @@ export const ListItem = forwardRef<ListItemRef, ListItemProps>(
6768
disabled && styles.disabled,
6869
focused && styles.focused,
6970
active && styles.active,
71+
clickable && styles.clickable,
7072
className
7173
)}
7274
ref={forwardedRef}

0 commit comments

Comments
 (0)