Skip to content

Commit

Permalink
refactor: simplify mergeform styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkbjo committed Dec 9, 2024
1 parent f002dea commit 78cbf0f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/app/AppWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const AppWrapper = ({ children }: AppWrapperProps) => {
return (
<>
<CssReset />
<CssVariables theme spacers colors />
<CssVariables theme spacers colors elevations />
<LoadApp>{children}</LoadApp>
</>
)
Expand Down
1 change: 0 additions & 1 deletion src/app/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export const Layout = () => {
// hide the sidebar if any matched route specifies it
const hideSidebar = matches.some((match) => match.handle?.hideSidebar)
const showFooter = matches.some((match) => match.handle?.showFooter)

return (
<SidebarLayout hideSidebar={hideSidebar} showFooter={showFooter}>
<Outlet />
Expand Down
10 changes: 3 additions & 7 deletions src/components/merge/MergeFieldsBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,9 @@ export const BaseTargetField = ({
showEndLoader={!!queryResult.availableQuery.hasNextPage}
selected={targetField.input.value?.id}
onChange={({ selected }) => {
targetField.input.onChange({
target: {
value: queryResult.available.find(
(d) => d.id === selected
),
},
})
targetField.input.onChange(
queryResult.available.find((d) => d.id === selected)
)
}}
placeholder={placeholder || 'Select the model to merge into'}
/>
Expand Down
24 changes: 13 additions & 11 deletions src/components/merge/MergeFormBase.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import cx from 'classnames'
import React from 'react'
import { Form } from 'react-final-form'
import css from './MergeForm.module.css'

Check failure on line 4 in src/components/merge/MergeFormBase.tsx

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module './MergeForm.module.css'
import { MergeFormValuesBase } from './mergeSchemaBase'

export type MergeFormBaseProps<TValues> = {
Expand Down Expand Up @@ -28,19 +30,19 @@ export const MergeFormBase = <TValues extends MergeFormValuesBase>({
}}
>
{({ handleSubmit }) => (
<form
onSubmit={handleSubmit}
style={{
display: 'flex',
flexDirection: 'column',
gap: '16px',
padding: '16px',
backgroundColor: 'white',
}}
>
<StyledMergeForm onSubmit={handleSubmit}>
{children}
</form>
</StyledMergeForm>
)}
</Form>
)
}

export const StyledMergeForm = ({
children,
...formProps
}: React.PropsWithChildren<React.ComponentProps<'form'>>) => (
<form className={cx(css.mergeForm, formProps.className)} {...formProps}>
{children}
</form>
)

0 comments on commit 78cbf0f

Please sign in to comment.