Skip to content

Commit

Permalink
chore(web): Add SettingsButtons Component (#513)
Browse files Browse the repository at this point in the history
Co-authored-by: JAESUNG_PARK <[email protected]>
Co-authored-by: 長田淳史 <>
Co-authored-by: JAESUNG_PARK <[email protected]>
Co-authored-by: KaWaite <[email protected]>
  • Loading branch information
4 people authored Jul 3, 2023
1 parent 34c54f7 commit 6d0ab3e
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 0 deletions.
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;

0 comments on commit 6d0ab3e

Please sign in to comment.