diff --git a/web/src/beta/components/Blocks/ImageBlock/index.stories.tsx b/web/src/beta/components/Blocks/ImageBlock/index.stories.tsx new file mode 100644 index 0000000000..c4aae8964e --- /dev/null +++ b/web/src/beta/components/Blocks/ImageBlock/index.stories.tsx @@ -0,0 +1,39 @@ +import { Meta, StoryObj } from "@storybook/react"; + +import ImageBlock from "."; + +export default { + component: ImageBlock, +} as Meta; + +const Container: React.FC<{ children?: React.ReactNode }> = ({ children }) => ( +
{children}
+); + +type Story = StoryObj; + +export const Default: Story = { + args: { + src: "http://placehold.it/430X260", + }, + render: args => { + return ( + + + + ); + }, +}; + +export const Blank: Story = { + args: { + src: "", + }, + render: args => { + return ( + + + + ); + }, +}; diff --git a/web/src/beta/components/Blocks/ImageBlock/index.tsx b/web/src/beta/components/Blocks/ImageBlock/index.tsx new file mode 100644 index 0000000000..a2aef4e426 --- /dev/null +++ b/web/src/beta/components/Blocks/ImageBlock/index.tsx @@ -0,0 +1,39 @@ +import Icon from "@reearth/beta/components/Icon"; +import { styled } from "@reearth/services/theme"; + +type Props = { + src: string; + alt?: string; +}; + +const ImageBlock: React.FC = ({ src, alt }) => { + return src ? ( + + + + ) : ( + + + + ); +}; + +const Wrapper = styled.div` + width: inherit; +`; + +const ImageBox = styled.img` + display: flex; + object-fit: cover; + width: 100%; +`; + +const BlankImageBox = styled.div` + display: flex; + aspect-ratio: 43/26; + background: #f1f1f1; + align-items: center; + justify-content: center; +`; + +export default ImageBlock; diff --git a/web/src/beta/components/Icon/Icons/image.svg b/web/src/beta/components/Icon/Icons/image.svg new file mode 100644 index 0000000000..1a5a9e43f8 --- /dev/null +++ b/web/src/beta/components/Icon/Icons/image.svg @@ -0,0 +1,3 @@ + + + diff --git a/web/src/beta/components/Icon/icons.ts b/web/src/beta/components/Icon/icons.ts index cbefe72974..0ac75908f7 100644 --- a/web/src/beta/components/Icon/icons.ts +++ b/web/src/beta/components/Icon/icons.ts @@ -54,6 +54,9 @@ import TwoRectangle from "./Icons/two-rectangle.svg"; // Plus import Plus from "./Icons/plus.svg"; +// Image +import Image from "./Icons/image.svg"; + export default { file: File, dl: InfoTable, @@ -87,4 +90,5 @@ export default { workspaceAdd: WorkspaceAdd, workspaces: Workspaces, checkmark: CheckMark, + image: Image, };