-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…2301) <!-- 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 --> - #2293 <!-- Fixes #0000 --> ## Summary <!-- Please brief explanation of the changes made --> - `ToggleEmojiButtonGroup`과 `ToggleEmojiButtonSource` 컴포넌트를 구현합니다. ## Details <!-- Please elaborate description of the changes --> - fillDirection="all" 일 때 컨테이너에 넘치지 않을 만큼 가로 세로 1:1 비율로 늘어나는 스타일을 css 로 구현하는 것이 어려웠습니다. aspect-ration: 1/1, width: 100%, height: auto 로 시도해봤으나, 컨테이너가 100px * 50px 의 크기를 가질 때 버튼이 100px * 100px 로 되버리는 문제가 있었습니다. 어쩔 수 없이 js로 계산해서 resizeObserver까지 다는 방식으로 구현했습니다. - `ToggleEmojiButtonSource`컴포넌트안에 이모지를 보여줄때, imageUrl를 props로 열여주는 것도 생각했지만 이렇게 하면 모바일에서 구현이 어려운 문제가 있어서 content속성을 그대로 활용했습니다. ### 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 --> - [컴포넌트 스펙(internal)](https://www.notion.so/channelio/Toggle-Icon-Button-Group-8b320d0c2dbe4d4b8d5731f95fece172) - [디자인(internal)](https://www.figma.com/design/fPXP9zfjZU9NyARnhTWL6o/Input?node-id=534-870&t=yVpw7vZQjCm6IsCK-0)
- Loading branch information
1 parent
8e6fb64
commit 26658dc
Showing
12 changed files
with
423 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@channel.io/bezier-react': patch | ||
--- | ||
|
||
Add `ToggleEmojiButtonGroup` and `ToggleEmojiButtonSource` component. |
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
66 changes: 66 additions & 0 deletions
66
...-react/src/components/AlphaToggleEmojiButtonGroup/AlphaToggleEmojiButtonGroup.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,66 @@ | ||
import React from 'react' | ||
|
||
import type { Meta, StoryFn, StoryObj } from '@storybook/react' | ||
|
||
import { Center } from '~/src/components/Center' | ||
|
||
import { | ||
ToggleEmojiButtonGroup, | ||
ToggleEmojiButtonSource, | ||
} from './ToggleEmojiButtonGroup' | ||
import type { | ||
ToggleEmojiButtonGroupProps, | ||
ToggleEmojiButtonSourceProps, | ||
} from './ToggleEmojiButtonGroup.types' | ||
|
||
const meta: Meta<typeof ToggleEmojiButtonGroup> = { | ||
component: ToggleEmojiButtonGroup, | ||
} | ||
export default meta | ||
|
||
type ToggleButtonCompositionType = ToggleEmojiButtonGroupProps & | ||
Pick<ToggleEmojiButtonSourceProps, 'variant'> | ||
|
||
const Template: StoryFn<ToggleButtonCompositionType> = ({ | ||
fillDirection, | ||
variant, | ||
}) => { | ||
return ( | ||
<Center | ||
width="25vw" | ||
height="15vh" | ||
backgroundColor="bg-lounge" | ||
> | ||
<ToggleEmojiButtonGroup | ||
defaultValue="blush" | ||
fillDirection={fillDirection} | ||
> | ||
<ToggleEmojiButtonSource | ||
variant={variant} | ||
value="blush" | ||
name="blush" | ||
/> | ||
<ToggleEmojiButtonSource | ||
variant={variant} | ||
value="grinning" | ||
name="grinning" | ||
/> | ||
</ToggleEmojiButtonGroup> | ||
</Center> | ||
) | ||
} | ||
|
||
export const Primary = { | ||
render: Template, | ||
|
||
args: { | ||
fillDirection: 'horizontal', | ||
variant: 'primary', | ||
}, | ||
parameters: { | ||
design: { | ||
type: 'link', | ||
url: 'https://www.figma.com/design/fPXP9zfjZU9NyARnhTWL6o/Input?node-id=425-281&t=ktusTVyr8cD3cTlt-1', | ||
}, | ||
}, | ||
} satisfies StoryObj<ToggleButtonCompositionType> |
76 changes: 76 additions & 0 deletions
76
...ezier-react/src/components/AlphaToggleEmojiButtonGroup/ToggleEmojiButtonGroup.module.scss
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,76 @@ | ||
@use '../../styles/mixins/dimension'; | ||
|
||
.ToggleEmojiButtonGroup { | ||
display: flex; | ||
gap: var(--b-toggle-emoji-button-group-gap); | ||
align-items: center; | ||
justify-content: center; | ||
|
||
/* stylelint-disable-next-line selector-class-pattern */ | ||
&:where(.fillDirection-horizontal) { | ||
width: 100%; | ||
|
||
& :where(.ToggleEmojiButtonSource) { | ||
flex-grow: 1; | ||
} | ||
} | ||
|
||
/* stylelint-disable-next-line selector-class-pattern */ | ||
&:where(.fillDirection-all) { | ||
width: 100%; | ||
height: 100%; | ||
|
||
& :is(.ToggleEmojiButtonSource) { | ||
max-width: 160px; | ||
max-height: 160px; | ||
} | ||
} | ||
} | ||
|
||
.ToggleEmojiButtonSource { | ||
position: relative; | ||
|
||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
|
||
padding: 12px; | ||
|
||
border-radius: var(--radius-12); | ||
|
||
&:where(.size-m) { | ||
@include dimension.square(var(--b-toggle-emoji-button-size)); | ||
} | ||
|
||
&:where(.variant-primary) { | ||
background-color: var(--alpha-color-bg-grey-lightest); | ||
box-shadow: var(--alpha-shadow-input-default); | ||
|
||
&:where(&:hover) { | ||
background-color: var(--alpha-color-bg-grey-lighter); | ||
} | ||
|
||
&:where([data-state='on']) { | ||
background-color: var(--alpha-color-bg-blue-lightest); | ||
box-shadow: 0 0 0 1px var(--alpha-color-primary-bg-normal) inset; | ||
} | ||
} | ||
|
||
&:where(.variant-secondary) { | ||
background-color: var(--alpha-color-bg-black-lightest); | ||
|
||
&:where(&:hover) { | ||
background-color: var(--alpha-color-bg-black-lighter); | ||
} | ||
|
||
&:where([data-state='on']) { | ||
background-color: var(--alpha-color-primary-bg-lighter); | ||
} | ||
} | ||
|
||
& :where(.ButtonContent) { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
} |
Oops, something went wrong.