-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(web): add container settings panel for widget area (#620)
- Loading branch information
Showing
11 changed files
with
169 additions
and
22 deletions.
There are no files selected for viewing
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
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
84 changes: 84 additions & 0 deletions
84
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 |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import TextInput from "@reearth/beta/components/properties/TextInput"; | ||
import SidePanelSectionField from "@reearth/beta/components/SidePanelSectionField"; | ||
import { WidgetAreaPadding, WidgetAreaState } from "@reearth/services/state"; | ||
|
||
type Props = { | ||
widgetArea: WidgetAreaState; | ||
onWidgetAreaStateChange: (widgetArea: WidgetAreaState) => void; | ||
}; | ||
|
||
const ContainerSettings: React.FC<Props> = ({ widgetArea, onWidgetAreaStateChange }) => { | ||
// TODO: This is dummy UI | ||
return ( | ||
<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 => { | ||
onWidgetAreaStateChange({ | ||
...widgetArea, | ||
gap: Number(newVal) ?? 0, | ||
}); | ||
}} | ||
/> | ||
|
||
<div>[Switch field] Align Center {!!widgetArea?.centered}</div> | ||
<div>[Color field] Background Color {widgetArea?.background}</div> | ||
</SidePanelSectionField> | ||
); | ||
}; | ||
|
||
export default ContainerSettings; |
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
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
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
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