Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(web): add actionItem to beta #497

Merged
merged 12 commits into from
Jun 28, 2023
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`
atnagata marked this conversation as resolved.
Show resolved Hide resolved
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;