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 all 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
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 @@ -39,6 +39,14 @@ import PlayRight from "./Icons/play-right.svg";
import PlayLeft from "./Icons/play-left.svg";
import Ellipse from "./Icons/ellipse.svg";

// Storytelling blocks
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 @@ -81,6 +89,13 @@ export default {
timeline: Timeline,
twoRectangle: TwoRectangle,
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={{ display: "flex" }}>{children}</div>
);

export const Default: Story = {
args: {
title: "Audio",
icon: "audio",
},
render: args => {
return (
<Wrapper>
<SettingsButtons {...args} />
</Wrapper>
);
},
};
53 changes: 53 additions & 0 deletions web/src/beta/components/SettingsButtons/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import Icon from "@reearth/beta/components/Icon";
import Text from "@reearth/beta/components/Text";
import { styled, useTheme } from "@reearth/services/theme";

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>
<StyledMainIcon size={16} onClick={onBlock} icon={icon} />
<StyledText size={"xFootnote"} color={theme.general.content.strong} onClick={onBlock}>
{title}
</StyledText>
<StyledSubIcon size={12} icon={"editIcon"} onClick={onEdit} />
<StyledSubIcon size={12} icon={"settings"} onClick={onSetting} />
</Wrapper>
);
};

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

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

const StyledText = styled(Text)`
padding: 0px 4px;
cursor: pointer;
`;

const StyledMainIcon = styled(Icon)`
padding: 2px;
cursor: pointer;
`;

const StyledSubIcon = styled(Icon)`
padding: 4px;
justify-items: center;
border-left: 0.5px solid ${props => props.theme.general.content.strong};
cursor: pointer;
`;

export default SettingsButtons;