Skip to content

Commit

Permalink
Chore(web): Add StorytellingPageSectionItem (#495)
Browse files Browse the repository at this point in the history
Co-authored-by: JAESUNG_PARK <131335554+FabPARKJAESUNG@users.noreply.github.com>
Co-authored-by: KaWaite <34051327+KaWaite@users.noreply.github.com>
Co-authored-by: JAESUNG_PARK <JAESUNG_PARK@tsyscom.co.jp>
Co-authored-by: 長田淳史 <>
  • Loading branch information
4 people committed Jun 23, 2023
1 parent 4b70565 commit 36ddb20
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 0 deletions.
3 changes: 3 additions & 0 deletions web/src/beta/components/Icon/Icons/square.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions web/src/beta/components/Icon/Icons/two-rectangle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions web/src/beta/components/Icon/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ import Logout from "./Icons/logout.svg";
import WorkspaceAdd from "./Icons/workspaceAdd.svg";
import Workspaces from "./Icons/workspaces.svg";

// Square
import Square from "./Icons/square.svg";
import TwoRectangle from "./Icons/two-rectangle.svg";

export default {
file: File,
dl: InfoTable,
Expand All @@ -68,7 +72,9 @@ export default {
ellipse: Ellipse,
playRight: PlayRight,
playLeft: PlayLeft,
square: Square,
timeline: Timeline,
twoRectangle: TwoRectangle,
actionbutton: ActionButton,
dashboard: Dashboard,
help: Help,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Meta, StoryObj } from "@storybook/react";

import StorytellingPageSectionItem from ".";

export default {
component: StorytellingPageSectionItem,
} as Meta;

type Story = StoryObj<typeof StorytellingPageSectionItem>;

export const Default: Story = {
args: {
icon: "square",
title: "New Page",
index: 1,
active: false,
},
};

export const LongText: Story = {
args: {
icon: "square",
title:
"gashjdjahasdasdasdasdasdjjashdjkashdjkahdjkhaskjdhasdasdasdasddfggjsdhasjkdhjkashdkjahskjdhakjshdkahskjdakjshdkjahsdkjhajksdhakjhsdkjhaksjhdakjhsdkjhakjsdhakjhsdkjsadasdasdahskdjhasdasdasdasdasdasdakjsdhksadasd",
index: 1,
active: false,
},
};
80 changes: 80 additions & 0 deletions web/src/beta/components/StorytellingPageSectionItem/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
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;
index: number;
active?: boolean;
onAction?: () => void;
onClick?: () => void;
};

const StorytellingPageSectionItem: FC<Props> = ({
icon,
title,
index,
active,
onAction,
onClick,
}) => {
const theme = useTheme();
return (
<HorizontalBox>
<VerticalBox>
<Text size={"body"}>{index}</Text>
<Icon icon={icon} />
</VerticalBox>
<TitleArea active={active}>
<Text
onClick={onClick}
size="footnote"
color={theme.general.content.strong}
otherProperties={{ wordBreak: "break-all" }}>
{title}
</Text>
<Wrapper>
<Icon icon="actionbutton" onClick={onAction} />
</Wrapper>
</TitleArea>
</HorizontalBox>
);
};

const HorizontalBox = styled.div`
display: flex;
min-height: 56px;
gap: 4px;
cursor: pointer;
`;

const VerticalBox = styled.div`
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 4px;
`;

const TitleArea = styled.div<{ active?: boolean }>`
display: flex;
justify-content: space-between;
padding: 8px;
gap: 4px;
background: ${props => (props.active ? props.theme.general.select : props.theme.general.bg.main)};
border: 1px solid
${props => (props.active ? props.theme.general.select : props.theme.general.bg.veryWeak)};
border-radius: 6px;
width: 100%;
`;

const Wrapper = styled.div`
height: 100%;
`;

export default StorytellingPageSectionItem;

0 comments on commit 36ddb20

Please sign in to comment.