Skip to content

Commit

Permalink
chore(web): fix gap field component (#801)
Browse files Browse the repository at this point in the history
Co-authored-by: nina992 <nouralali992@gmail.com>
  • Loading branch information
nina992 and nina992 committed Nov 8, 2023
1 parent f8ea057 commit f9b18c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
6 changes: 2 additions & 4 deletions web/src/beta/lib/core/StoryPanel/ActionPanel/index.tsx
Expand Up @@ -50,7 +50,6 @@ const ActionPanel: React.FC<Props> = ({
}) => {
const t = useT();
const ref = useItemContext();

const handleRemove = useCallback(() => {
onRemove?.();
onSettingsToggle?.();
Expand All @@ -75,7 +74,6 @@ const ActionPanel: React.FC<Props> = ({
}
return menuItems;
}, [settingsTitle, t, setShowPadding, onRemove, handleRemove]);
// console.log("PS", panelSettings);

return (
<Wrapper isSelected={isSelected} position={position} onClick={stopClickPropagation}>
Expand Down Expand Up @@ -120,12 +118,12 @@ const ActionPanel: React.FC<Props> = ({
</SettingsHeading>
{propertyId && panelSettings && (
<SettingsContent>
{Object.keys(panelSettings).map(fieldId => {
{Object.keys(panelSettings).map((fieldId, index) => {
const field = panelSettings[fieldId];
const groupId = "panel";
return (
<FieldComponent
key={groupId + propertyId}
key={index}
propertyId={propertyId}
groupId={groupId}
fieldId={fieldId}
Expand Down
7 changes: 3 additions & 4 deletions web/src/beta/lib/core/StoryPanel/Page/hooks.ts
Expand Up @@ -43,7 +43,6 @@ export default ({
const property = useMemo(() => page?.property, [page?.property]);

const propertyId = useMemo(() => page?.propertyId, [page?.propertyId]);

const panelSettings = useMemo(
() => ({
padding: {
Expand All @@ -55,10 +54,10 @@ export default ({
),
},
gap: {
...property?.panel?.gap,
value:
property?.panel?.gap?.value ?? isEditable
? MIN_STORY_PAGE_GAP_IN_EDITOR
: DEFAULT_STORY_PAGE_GAP,
property?.panel?.gap?.value ??
(isEditable ? MIN_STORY_PAGE_GAP_IN_EDITOR : DEFAULT_STORY_PAGE_GAP),
},
}),
[property?.panel, isEditable],
Expand Down

0 comments on commit f9b18c9

Please sign in to comment.