-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
97 additions
and
107 deletions.
There are no files selected for viewing
22 changes: 0 additions & 22 deletions
22
web/src/beta/features/Editor/tabs/widgets/SidePanel/ContainerSettings/hooks.ts
This file was deleted.
Oops, something went wrong.
149 changes: 68 additions & 81 deletions
149
web/src/beta/features/Editor/tabs/widgets/SidePanel/ContainerSettings/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,84 @@ | ||
import TextInput from "@reearth/beta/components/properties/TextInput"; | ||
import SidePanelSectionField from "@reearth/beta/components/SidePanelSectionField"; | ||
import { WidgetAreaPadding, WidgetAreaState } from "@reearth/services/state"; | ||
import { styled } from "@reearth/services/theme"; | ||
|
||
import useHooks from "./hooks"; | ||
|
||
type Props = { | ||
sceneId: string; | ||
widgetArea: WidgetAreaState; | ||
onWidgetAreaStateChange: (widgetArea: WidgetAreaState) => void; | ||
}; | ||
|
||
const ContainerSettings: React.FC<Props> = ({ sceneId, widgetArea }) => { | ||
const { handleAreaStateChange } = useHooks({ sceneId }); | ||
|
||
const ContainerSettings: React.FC<Props> = ({ widgetArea, onWidgetAreaStateChange }) => { | ||
// TODO: This is dummy UI | ||
return ( | ||
<Wrapper> | ||
<SidePanelSectionField> | ||
<TextInput | ||
name="Padding Top" | ||
value={widgetArea?.padding?.top.toString()} | ||
onChange={newVal => { | ||
handleAreaStateChange?.({ | ||
...widgetArea, | ||
padding: { | ||
...(widgetArea.padding as WidgetAreaPadding), | ||
top: Number(newVal) ?? 0, | ||
}, | ||
}); | ||
}} | ||
/> | ||
<TextInput | ||
name="Padding Right" | ||
value={widgetArea?.padding?.right.toString()} | ||
onChange={newVal => { | ||
handleAreaStateChange?.({ | ||
...widgetArea, | ||
padding: { | ||
...(widgetArea.padding as WidgetAreaPadding), | ||
right: Number(newVal) ?? 0, | ||
}, | ||
}); | ||
}} | ||
/> | ||
<TextInput | ||
name="Padding Bottom" | ||
value={widgetArea?.padding?.bottom.toString()} | ||
onChange={newVal => { | ||
handleAreaStateChange?.({ | ||
...widgetArea, | ||
padding: { | ||
...(widgetArea.padding as WidgetAreaPadding), | ||
bottom: Number(newVal) ?? 0, | ||
}, | ||
}); | ||
}} | ||
/> | ||
<TextInput | ||
name="Padding Left" | ||
value={widgetArea?.padding?.left.toString()} | ||
onChange={newVal => { | ||
handleAreaStateChange?.({ | ||
...widgetArea, | ||
padding: { | ||
...(widgetArea.padding as WidgetAreaPadding), | ||
left: Number(newVal) ?? 0, | ||
}, | ||
}); | ||
}} | ||
/> | ||
<SidePanelSectionField> | ||
<TextInput | ||
name="Padding Top" | ||
value={widgetArea?.padding?.top.toString()} | ||
onChange={newVal => { | ||
onWidgetAreaStateChange({ | ||
...widgetArea, | ||
padding: { | ||
...(widgetArea.padding as WidgetAreaPadding), | ||
top: Number(newVal) ?? 0, | ||
}, | ||
}); | ||
}} | ||
/> | ||
<TextInput | ||
name="Padding Right" | ||
value={widgetArea?.padding?.right.toString()} | ||
onChange={newVal => { | ||
onWidgetAreaStateChange({ | ||
...widgetArea, | ||
padding: { | ||
...(widgetArea.padding as WidgetAreaPadding), | ||
right: Number(newVal) ?? 0, | ||
}, | ||
}); | ||
}} | ||
/> | ||
<TextInput | ||
name="Padding Bottom" | ||
value={widgetArea?.padding?.bottom.toString()} | ||
onChange={newVal => { | ||
onWidgetAreaStateChange({ | ||
...widgetArea, | ||
padding: { | ||
...(widgetArea.padding as WidgetAreaPadding), | ||
bottom: Number(newVal) ?? 0, | ||
}, | ||
}); | ||
}} | ||
/> | ||
<TextInput | ||
name="Padding Left" | ||
value={widgetArea?.padding?.left.toString()} | ||
onChange={newVal => { | ||
onWidgetAreaStateChange({ | ||
...widgetArea, | ||
padding: { | ||
...(widgetArea.padding as WidgetAreaPadding), | ||
left: Number(newVal) ?? 0, | ||
}, | ||
}); | ||
}} | ||
/> | ||
|
||
<TextInput | ||
name="Gap Spacing" | ||
value={(widgetArea?.gap ?? 0).toString()} | ||
onChange={newVal => { | ||
handleAreaStateChange?.({ | ||
...widgetArea, | ||
gap: Number(newVal) ?? 0, | ||
}); | ||
}} | ||
/> | ||
<TextInput | ||
name="Gap Spacing" | ||
value={(widgetArea?.gap ?? 0).toString()} | ||
onChange={newVal => { | ||
onWidgetAreaStateChange({ | ||
...widgetArea, | ||
gap: Number(newVal) ?? 0, | ||
}); | ||
}} | ||
/> | ||
|
||
<div>[Switch field] Align Center {!!widgetArea?.centered}</div> | ||
<div>[Color field] Background Color {widgetArea?.background}</div> | ||
</SidePanelSectionField> | ||
</Wrapper> | ||
<div>[Switch field] Align Center {!!widgetArea?.centered}</div> | ||
<div>[Color field] Background Color {widgetArea?.background}</div> | ||
</SidePanelSectionField> | ||
); | ||
}; | ||
|
||
export default ContainerSettings; | ||
|
||
const Wrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 8px; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters