Skip to content

Commit

Permalink
chore(web): Multi layer Select (#757)
Browse files Browse the repository at this point in the history
Co-authored-by: KaWaite <[email protected]>
  • Loading branch information
jashanbhullar and KaWaite authored Nov 10, 2023
1 parent 1ca1531 commit 0e75fa8
Show file tree
Hide file tree
Showing 27 changed files with 686 additions and 177 deletions.
1 change: 1 addition & 0 deletions server/pkg/builtin/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2485,6 +2485,7 @@ extensions:
- id: default
title: Link Button
list: true
representativeField: title
fields:
- id: title
type: string
Expand Down
60 changes: 59 additions & 1 deletion server/pkg/builtin/manifest_ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1091,4 +1091,62 @@ extensions:
title: 動画
fields:
text:
title: コンテンツ
title: コンテンツ
cameraButtonStoryBlock:
name: カメラボタン
description: ストーリーテリングのカメラ移動出来るボタンブロック
propertySchema:
panel:
title: パネル設定
fields:
padding:
title: 余白
default:
title: カメラボタン
fields:
title:
title: タイトル
color:
title:
bgColor:
title: 背景色
cameraPosition:
title: カメラ位置
cameraDuration:
title: カメラ移動時間
timelineStoryBlock:
name: タイムライン
description: ストーリーテリングの時間変更できるブロック
propertySchema:
panel:
title: パネル設定
fields:
padding:
title: 余白
default:
title: タイムライン設定
fields:
timelineSetting:
title: タイムライン設定
playMode:
title: プレイモード
showLayersStoryBlock:
name: レイヤーボタン
description: ストーリーテリングのレイヤー変更出来るボタンブロック
propertySchema:
panel:
title: パネル設定
fields:
padding:
title: 余白
default:
title: レイヤーボタン
fields:
title:
title: タイトル
color:
title:
bgColor:
title: 背景色
showLayers:
title: 見えるレイヤー
3 changes: 3 additions & 0 deletions web/src/beta/components/Icon/Icons/layer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions web/src/beta/components/Icon/Icons/showLayersStoryBlock.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.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import ZoomToLayer from "./Icons/zoomToLayer.svg";
import LayerStyleIcon from "./Icons/layerStyle.svg";
import AddLayerStyleButtonIcon from "./Icons/addLayerStyleButton.svg";
import LayerInspector from "./Icons/layerInspector.svg";
import LayerIcon from "./Icons/layer.svg";
import Clock from "./Icons/Clock.svg";

// MSIC
Expand Down Expand Up @@ -90,6 +91,7 @@ import VideoStoryBlock from "./Icons/videoStoryBlock.svg";
import ImageStoryBlock from "./Icons/imageStoryBlock.svg";
import MdTextStoryBlock from "./Icons/mdTextStoryBlock.svg";
import CameraButtonStoryBlock from "./Icons/cameraButtonStoryBlock.svg";
import ShowLayersStoryBlock from "./Icons/showLayersStoryBlock.svg";
import TimelineStoryBlock from "./Icons/timelineStoryBlock.svg";

// Widget tab
Expand Down Expand Up @@ -119,6 +121,7 @@ import PublicGitHubRepo from "./Icons/publicGitHubRepo.svg";
import Marketplace from "./Icons/marketplace.svg";

export default {
layer: LayerIcon,
addLayerStyle: AddLayerStyleButtonIcon,
layerStyle: LayerStyleIcon,
layerInspector: LayerInspector,
Expand Down Expand Up @@ -187,6 +190,7 @@ export default {
imageStoryBlock: ImageStoryBlock,
mdTextStoryBlock: MdTextStoryBlock,
cameraButtonStoryBlock: CameraButtonStoryBlock,
showLayersStoryBlock: ShowLayersStoryBlock,
timelineStoryBlock: TimelineStoryBlock,
widget: Widgets,
widgets: Widgets,
Expand Down
73 changes: 66 additions & 7 deletions web/src/beta/components/fields/SelectField/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useCallback } from "react";

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

import SelectField, { Props } from ".";
import SelectField, { SingleSelectProps, MultiSelectProps } from ".";

const meta: Meta<typeof SelectField> = {
component: SelectField,
Expand All @@ -14,10 +14,15 @@ export default meta;

type Story = StoryObj<typeof SelectField>;

export const Default: Story = (args: Props) => {
export const Default: Story = (args: SingleSelectProps) => {
const [_, updateArgs] = useArgs();

const handleChange = useCallback((value: string) => updateArgs({ value: value }), [updateArgs]);
const handleChange = useCallback(
(value: string) => {
updateArgs({ value: value });
},
[updateArgs],
);

return (
<Wrapper>
Expand All @@ -29,18 +34,51 @@ export const Default: Story = (args: Props) => {
{...args}
name="Disabled"
description="Props are controlled by the field above"
placeholder="This is a disabled field"
disabled={true}
onChange={handleChange}
/>
</div>
<div>
<SelectField
{...args}
name="Empty"
value={undefined}
description="Even if you try, you won't be able to select the value"
name="Multi Select"
description="You can select multiple options"
onChange={handleChange}
/>
</div>
</Wrapper>
);
};

export const MultiSelect: Story = (args: MultiSelectProps) => {
const [_, updateArgs] = useArgs();

const handleChange = useCallback(
(value: string[] | undefined) => {
updateArgs({ value: value });
},
[updateArgs],
);

return (
<Wrapper>
<div>
<SelectField
{...args}
name="Multi Select"
description="You can select multiple options"
onChange={handleChange}
multiSelect
/>
</div>
<div>
<SelectField
{...args}
name="Disabled"
description="Props are controlled by the field above"
disabled={true}
onChange={handleChange}
multiSelect
/>
</div>
</Wrapper>
Expand Down Expand Up @@ -72,3 +110,24 @@ Default.args = {
],
onChange: () => console.log("clicked"),
};

MultiSelect.args = {
name: "Select Field",
description: "Select from the options ",
disabled: false,
value: undefined,
options: [
{
label: "item 1",
key: "item_1",
},
{ label: "item 2", key: "item_2" },
{ label: "item 3", key: "item_3" },
{ label: "item 4", key: "item_4" },
{ label: "item 5", key: "item_5" },
{ label: "item 6", key: "item_6" },
{ label: "item 7", key: "item_7" },
],
multiSelect: true,
onChange: () => console.log("clicked"),
};
Loading

0 comments on commit 0e75fa8

Please sign in to comment.