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 SettingsButtons Component #513

Merged
merged 17 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions web/src/beta/components/Icon/Icons/audio.svg
KaWaite marked this conversation as resolved.
Show resolved Hide resolved
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/buttonBlock.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/camera.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/clock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/src/beta/components/Icon/Icons/editIcon.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/mdFile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/src/beta/components/Icon/Icons/settings.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/src/beta/components/Icon/Icons/video.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions web/src/beta/components/Icon/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ import PlayRight from "./Icons/play-right.svg";
import PlayLeft from "./Icons/play-left.svg";
import Ellipse from "./Icons/ellipse.svg";

// SettingsButton
KaWaite marked this conversation as resolved.
Show resolved Hide resolved
import Audio from "./Icons/audio.svg";
import EditIcon from "./Icons/editIcon.svg";
import Settings from "./Icons/settings.svg";
import ButtonBlock from "./Icons/buttonBlock.svg";
import Camera from "./Icons/camera.svg";
import MdFile from "./Icons/mdFile.svg";
import Clock from "./Icons/clock.svg";
//Dashboard
import Dashboard from "./Icons/dashboard.svg";
import Logout from "./Icons/logout.svg";
Expand Down Expand Up @@ -68,6 +76,13 @@ export default {
playLeft: PlayLeft,
timeline: Timeline,
actionbutton: ActionButton,
audio: Audio,
editIcon: EditIcon,
settings: Settings,
buttonBlock: ButtonBlock,
camera: Camera,
mdFile: MdFile,
clock: Clock,
dashboard: Dashboard,
help: Help,
logout: Logout,
Expand Down
28 changes: 28 additions & 0 deletions web/src/beta/components/SettingsButtons/index.stories.tsx
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={{ width: "96px" }}>{children}</div>
KaWaite marked this conversation as resolved.
Show resolved Hide resolved
);

export const Default: Story = {
args: {
title: "Audio",
icon: "audio",
},
render: args => {
return (
<Wrapper>
<SettingsButtons {...args} />
</Wrapper>
);
},
};
67 changes: 67 additions & 0 deletions web/src/beta/components/SettingsButtons/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import React from "react";
KaWaite marked this conversation as resolved.
Show resolved Hide resolved

import { styled, useTheme } from "@reearth/services/theme";

import Icon from "../Icon";
import Text from "../Text";

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>
<Icon
size={16}
style={{
KaWaite marked this conversation as resolved.
Show resolved Hide resolved
padding: "2px",
}}
onClick={onBlock}
icon={icon}
/>
<Text
size={"xFootnote"}
color={theme.general.content.strong}
otherProperties={{ padding: "0px 4px" }}
onClick={onBlock}>
{title}
</Text>
<Icon
size={12}
style={{
justifyItems: "center",
padding: "4px",
borderLeft: `0.5px solid ${theme.general.content.strong}`,
}}
icon={"editIcon"}
onClick={onEdit}
/>
<Icon
size={12}
style={{
padding: "4px",
borderLeft: `0.5px solid ${theme.general.content.strong}`,
}}
icon={"settings"}
onClick={onSetting}
/>
</Wrapper>
);
};

const Wrapper = styled.div`
display: flex;
align-items: center;

height: 100%;
background: ${props => props.theme.general.select};
`;

export default SettingsButtons;