Skip to content

Commit

Permalink
fix(edit): created new type for removing footer
Browse files Browse the repository at this point in the history
  • Loading branch information
vildeopp committed Jul 4, 2023
1 parent 2c34f63 commit 69bac68
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions next-tavla/src/Admin/components/FooterInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ function FooterInput({ footer }: { footer?: string }) {
clearable={true}
onClear={() =>
dispatch({
type: 'addFooter',
footer: '',
type: 'removeFooter',
})
}
/>
Expand Down
7 changes: 7 additions & 0 deletions next-tavla/src/Admin/scenarios/Edit/reducer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export type Action =
}
| { type: 'toggleLine'; tileId: string; lineId: string }
| { type: 'addFooter'; footer: string }
| { type: 'removeFooter' }

export function settingsReducer(
settings: TSettings,
Expand Down Expand Up @@ -170,5 +171,11 @@ export function settingsReducer(
footer: action.footer,
}
}
case 'removeFooter': {
return {
...settings,
footer: '',
}
}
}
}
3 changes: 1 addition & 2 deletions next-tavla/src/Shared/types/settings.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { TTile } from './tile'

export type TTheme = 'entur' | 'dark' | 'light'
export type TFooter = string

export type TSettings = {
tiles: TTile[]
version?: number
theme?: TTheme
footer?: TFooter
footer?: string
}

0 comments on commit 69bac68

Please sign in to comment.