Skip to content

Commit

Permalink
chore(web): add actionItem to beta (#497)
Browse files Browse the repository at this point in the history
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
4 people authored Jun 28, 2023
1 parent 3a12f5f commit d48d549
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
16 changes: 16 additions & 0 deletions web/src/beta/components/ActionItem/index.stories.tsx
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",
},
};
47 changes: 47 additions & 0 deletions web/src/beta/components/ActionItem/index.tsx
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;

0 comments on commit d48d549

Please sign in to comment.