generated from mantinedev/next-pages-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from medreporter/rearrange-properties
Rearrange properties
- Loading branch information
Showing
34 changed files
with
289 additions
and
213 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
7 changes: 7 additions & 0 deletions
7
src/components/designer/properties/BooleanDefaultProperty.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,7 @@ | ||
import { useSiteTranslation } from "~/hooks/useSiteTranslation" | ||
import { BooleanMetaProperty } from "./BooleanMetaProperty" | ||
|
||
export const BooleanDefaultProperty = () => { | ||
const { t } = useSiteTranslation() | ||
return <BooleanMetaProperty name="default" label={t("BooleanDefaultProperty.label")} /> | ||
} |
15 changes: 15 additions & 0 deletions
15
src/components/designer/properties/BooleanMetaProperty.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,15 @@ | ||
import { Switch } from "@mantine/core" | ||
import { Controller } from "react-hook-form" | ||
|
||
interface BooleanMetaPropertyProps { | ||
name: string | ||
label: string | ||
} | ||
export const BooleanMetaProperty = ({ name, label }: BooleanMetaPropertyProps) => ( | ||
<Controller | ||
name={name} | ||
render={({ field: { value, onChange }, fieldState: { error } }) => ( | ||
<Switch label={label} value={value} onChange={onChange} error={error?.message} /> | ||
)} | ||
/> | ||
) |
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,7 @@ | ||
import { useSiteTranslation } from "~/hooks/useSiteTranslation" | ||
import { BooleanMetaProperty } from "./BooleanMetaProperty" | ||
|
||
export const BorderProperty = () => { | ||
const { t } = useSiteTranslation() | ||
return <BooleanMetaProperty name="border" label={t("BorderProperty.label")} /> | ||
} |
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,27 +1,7 @@ | ||
import { Group, Textarea } from "@mantine/core" | ||
import { Controller } from "react-hook-form" | ||
import { useSiteTranslation } from "~/hooks/useSiteTranslation" | ||
import { ScriptEditorButton } from "../scriptEditor/ScriptEditorButton" | ||
import { ScriptEditorMetaProperty } from "./ScriptEditorMetaProperty" | ||
|
||
export const DisabledProperty = () => { | ||
const { t } = useSiteTranslation() | ||
|
||
return ( | ||
<Controller | ||
name="disabled" | ||
render={({ field: { value, onChange }, fieldState: { error } }) => ( | ||
<Textarea | ||
label={ | ||
<Group gap="xs" align="center"> | ||
{t("DisabledProperty.label")} | ||
<ScriptEditorButton /> | ||
</Group> | ||
} | ||
value={value} | ||
onChange={onChange} | ||
error={error?.message} | ||
/> | ||
)} | ||
/> | ||
) | ||
return <ScriptEditorMetaProperty name="disabled" label={t("DisabledProperty.label")} /> | ||
} |
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,21 +1,8 @@ | ||
import { TextInput } from "@mantine/core" | ||
import { Controller } from "react-hook-form" | ||
import { useSiteTranslation } from "~/hooks/useSiteTranslation" | ||
import { TextMetaProperty } from "./TextMetaProperty" | ||
|
||
export const FieldIdProperty = () => { | ||
const { t } = useSiteTranslation() | ||
|
||
return ( | ||
<Controller | ||
name="fieldId" | ||
render={({ field: { value, onChange }, fieldState: { error } }) => ( | ||
<TextInput | ||
label={t("FieldIdProperty.label")} | ||
value={value} | ||
onChange={onChange} | ||
error={error?.message} | ||
/> | ||
)} | ||
/> | ||
) | ||
return <TextMetaProperty label={t("FieldIdProperty.label")} name="id" /> | ||
} |
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,24 @@ | ||
import { Group, Textarea } from "@mantine/core" | ||
import { Controller } from "react-hook-form" | ||
import { useSiteTranslation } from "~/hooks/useSiteTranslation" | ||
|
||
export const FigureProperty = () => { | ||
const { t } = useSiteTranslation() | ||
return ( | ||
<Controller | ||
name="figure" | ||
render={({ field: { value, onChange }, fieldState: { error } }) => ( | ||
<Textarea | ||
label={ | ||
<Group gap="xs" align="center"> | ||
{t("FigureProperty.label")} | ||
</Group> | ||
} | ||
value={value} | ||
onChange={onChange} | ||
error={error?.message} | ||
/> | ||
)} | ||
/> | ||
) | ||
} |
7 changes: 7 additions & 0 deletions
7
src/components/designer/properties/FreeTextDefaultProperty.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,7 @@ | ||
import { useSiteTranslation } from "~/hooks/useSiteTranslation" | ||
import { TextMetaProperty } from "./TextMetaProperty" | ||
|
||
export const FreeTextDefaultProperty = () => { | ||
const { t } = useSiteTranslation() | ||
return <TextMetaProperty name="default" label={t("FreeTextDefaultProperty.label")} /> | ||
} |
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,27 +1,8 @@ | ||
import { Group, Textarea } from "@mantine/core" | ||
import { Controller } from "react-hook-form" | ||
import { useSiteTranslation } from "~/hooks/useSiteTranslation" | ||
import { ScriptEditorButton } from "../scriptEditor/ScriptEditorButton" | ||
import { ScriptEditorMetaProperty } from "./ScriptEditorMetaProperty" | ||
|
||
export const HiddenProperty = () => { | ||
const { t } = useSiteTranslation() | ||
|
||
return ( | ||
<Controller | ||
name="hidden" | ||
render={({ field: { value, onChange }, fieldState: { error } }) => ( | ||
<Textarea | ||
label={ | ||
<Group gap="xs" align="center"> | ||
{t("HiddenProperty.label")} | ||
<ScriptEditorButton /> | ||
</Group> | ||
} | ||
value={value} | ||
onChange={onChange} | ||
error={error?.message} | ||
/> | ||
)} | ||
/> | ||
) | ||
return <ScriptEditorMetaProperty name="hidden" label={t("HiddenProperty.label")} /> | ||
} |
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,21 +1,8 @@ | ||
import { TextInput } from "@mantine/core" | ||
import { Controller } from "react-hook-form" | ||
import { useSiteTranslation } from "~/hooks/useSiteTranslation" | ||
import { TextMetaProperty } from "./TextMetaProperty" | ||
|
||
export const LabelProperty = () => { | ||
const { t } = useSiteTranslation() | ||
|
||
return ( | ||
<Controller | ||
name="label" | ||
render={({ field: { value, onChange }, fieldState: { error } }) => ( | ||
<TextInput | ||
label={t("LabelProperty.label")} | ||
value={value} | ||
onChange={onChange} | ||
error={error?.message} | ||
/> | ||
)} | ||
/> | ||
) | ||
return <TextMetaProperty name="label" label={t("LabelProperty.label")} /> | ||
} |
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,7 @@ | ||
import { useSiteTranslation } from "~/hooks/useSiteTranslation" | ||
import { TextMetaProperty } from "./TextMetaProperty" | ||
|
||
export const LinkProperty = () => { | ||
const { t } = useSiteTranslation() | ||
return <TextMetaProperty name="link" label={t("LinkProperty.label")} /> | ||
} |
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,7 @@ | ||
import { useSiteTranslation } from "~/hooks/useSiteTranslation" | ||
import { BooleanMetaProperty } from "./BooleanMetaProperty" | ||
|
||
export const ListProperty = () => { | ||
const { t } = useSiteTranslation() | ||
return <BooleanMetaProperty name="list" label={t("ListProperty.label")} /> | ||
} |
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,7 @@ | ||
import { useSiteTranslation } from "~/hooks/useSiteTranslation" | ||
import { NumberMetaProperty } from "./NumberMetaProperty" | ||
|
||
export const MaxProperty = () => { | ||
const { t } = useSiteTranslation() | ||
return <NumberMetaProperty name="max" label={t("MaxProperty.label")} /> | ||
} |
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,7 @@ | ||
import { useSiteTranslation } from "~/hooks/useSiteTranslation" | ||
import { NumberMetaProperty } from "./NumberMetaProperty" | ||
|
||
export const MinProperty = () => { | ||
const { t } = useSiteTranslation() | ||
return <NumberMetaProperty name="min" label={t("MinProperty.label")} /> | ||
} |
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,7 @@ | ||
import { useSiteTranslation } from "~/hooks/useSiteTranslation" | ||
import { BooleanMetaProperty } from "./BooleanMetaProperty" | ||
|
||
export const MultilineProperty = () => { | ||
const { t } = useSiteTranslation() | ||
return <BooleanMetaProperty name="multiline" label={t("MultilineProperty.label")} /> | ||
} |
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,7 @@ | ||
import { useSiteTranslation } from "~/hooks/useSiteTranslation" | ||
import { NumberMetaProperty } from "./NumberMetaProperty" | ||
|
||
export const NumberDefaultProperty = () => { | ||
const { t } = useSiteTranslation() | ||
return <NumberMetaProperty name="default" label={t("NumberDefaultProperty.label")} /> | ||
} |
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,16 @@ | ||
import { NumberInput } from "@mantine/core" | ||
import { Controller } from "react-hook-form" | ||
|
||
interface NumberMetaPropertyProps { | ||
name: string | ||
label: string | ||
} | ||
|
||
export const NumberMetaProperty = ({ name, label }: NumberMetaPropertyProps) => ( | ||
<Controller | ||
name={name} | ||
render={({ field: { value, onChange }, fieldState: { error } }) => ( | ||
<NumberInput label={label} value={value} onChange={onChange} error={error?.message} /> | ||
)} | ||
/> | ||
) |
Oops, something went wrong.