-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(web): Add SettingsButtons Component (#513)
Co-authored-by: JAESUNG_PARK <[email protected]> Co-authored-by: 長田淳史 <> Co-authored-by: JAESUNG_PARK <[email protected]> Co-authored-by: KaWaite <[email protected]>
- Loading branch information
1 parent
34c54f7
commit 6d0ab3e
Showing
11 changed files
with
126 additions
and
0 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.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import React, { ReactNode } from "react"; | ||
|
||
import SettingsButtons from "."; | ||
|
||
export default { | ||
component: SettingsButtons, | ||
} as Meta; | ||
|
||
type Story = StoryObj<typeof SettingsButtons>; | ||
|
||
const Wrapper: React.FC<{ children: ReactNode }> = ({ children }) => ( | ||
<div style={{ display: "flex" }}>{children}</div> | ||
); | ||
|
||
export const Default: Story = { | ||
args: { | ||
title: "Audio", | ||
icon: "audio", | ||
}, | ||
render: args => { | ||
return ( | ||
<Wrapper> | ||
<SettingsButtons {...args} /> | ||
</Wrapper> | ||
); | ||
}, | ||
}; |
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,53 @@ | ||
import Icon from "@reearth/beta/components/Icon"; | ||
import Text from "@reearth/beta/components/Text"; | ||
import { styled, useTheme } from "@reearth/services/theme"; | ||
|
||
export interface Props { | ||
title: string; | ||
icon: string; | ||
onBlock?: () => void; | ||
onEdit?: () => void; | ||
onSetting?: () => void; | ||
} | ||
|
||
const SettingsButtons: React.FC<Props> = ({ title, icon, onBlock, onEdit, onSetting }) => { | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<Wrapper> | ||
<StyledMainIcon size={16} onClick={onBlock} icon={icon} /> | ||
<StyledText size={"xFootnote"} color={theme.general.content.strong} onClick={onBlock}> | ||
{title} | ||
</StyledText> | ||
<StyledSubIcon size={12} icon={"editIcon"} onClick={onEdit} /> | ||
<StyledSubIcon size={12} icon={"settings"} onClick={onSetting} /> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
const Wrapper = styled.div` | ||
display: flex; | ||
align-items: center; | ||
height: 100%; | ||
background: ${props => props.theme.general.select}; | ||
`; | ||
|
||
const StyledText = styled(Text)` | ||
padding: 0px 4px; | ||
cursor: pointer; | ||
`; | ||
|
||
const StyledMainIcon = styled(Icon)` | ||
padding: 2px; | ||
cursor: pointer; | ||
`; | ||
|
||
const StyledSubIcon = styled(Icon)` | ||
padding: 4px; | ||
justify-items: center; | ||
border-left: 0.5px solid ${props => props.theme.general.content.strong}; | ||
cursor: pointer; | ||
`; | ||
|
||
export default SettingsButtons; |