-
Notifications
You must be signed in to change notification settings - Fork 43
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 actionItem to beta (#497)
Co-authored-by: JAESUNG_PARK <[email protected]> Co-authored-by: JAESUNG_PARK <[email protected]> Co-authored-by: 長田淳史 <> Co-authored-by: KaWaite <[email protected]>
- Loading branch information
1 parent
3a12f5f
commit d48d549
Showing
2 changed files
with
63 additions
and
0 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,16 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import ActionItem from "."; | ||
|
||
export default { | ||
component: ActionItem, | ||
} as Meta; | ||
|
||
type Story = StoryObj<typeof ActionItem>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
title: "New Page", | ||
icon: "square", | ||
}, | ||
}; |
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,47 @@ | ||
import { FC } from "react"; | ||
|
||
import { styled, useTheme } from "@reearth/services/theme"; | ||
|
||
import Icon from "../Icon"; | ||
import Text from "../Text"; | ||
|
||
type Props = { | ||
icon: string; | ||
title: string; | ||
onClick?: () => void; | ||
}; | ||
|
||
const ActionItem: FC<Props> = ({ icon, title, onClick }) => { | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<Box onClick={onClick}> | ||
<Icon icon={icon} size={8} /> | ||
<Text | ||
size={"footnote"} | ||
color={theme.general.content.main} | ||
otherProperties={{ wordBreak: "break-all" }}> | ||
{title} | ||
</Text> | ||
</Box> | ||
); | ||
}; | ||
|
||
const Box = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
padding: 4px 12px; | ||
gap: 8px; | ||
min-height: 28px; | ||
background: ${props => props.theme.general.bg.main}; | ||
:hover { | ||
background: ${props => props.theme.general.bg.weak}; | ||
} | ||
user-select: none; | ||
cursor: pointer; | ||
`; | ||
|
||
export default ActionItem; |