Skip to content

Commit

Permalink
remove not used component (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarekVigas authored Feb 8, 2024
1 parent d58a3bd commit 3095c89
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 60 deletions.
53 changes: 3 additions & 50 deletions src/components/FormComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,68 +199,21 @@ export const BooleanRadio = <Name extends keyof UserInput>({
)
}

interface CheckboxProps<Name> {
name: Name
title: string
label?: string
hint?: string
}
export const Checkbox = <Name extends keyof UserInput>({
title,
hint,
label,
...props
}: CheckboxProps<Name>) => {
const [field, meta] = useField(props.name)
return (
<div className="govuk-form-group">
<fieldset className="govuk-fieldset" aria-describedby="waste-hint">
<legend className="govuk-fieldset__legend govuk-fieldset__legend--xl">
<h1 className="govuk-fieldset__heading">{title}</h1>
</legend>
{hint ? <span className="govuk-hint">{hint}</span> : null}
{meta.error ? (
<span id={props.name} className="govuk-error-message">
<span className="govuk-visually-hidden">Chyba:</span> {meta.error}
</span>
) : null}
<div className="govuk-checkboxes">
<div className="govuk-checkboxes__item">
<input
{...field}
{...props}
id={props.name}
className="govuk-checkboxes__input"
type="checkbox"
/>
<label
className="govuk-label govuk-checkboxes__label"
htmlFor={props.name}
>
{label ?? 'Ano'}
</label>
</div>
</div>
</fieldset>
</div>
)
}

interface CheckboxSmallProps {
interface CheckboxProps {
name: string
className?: string
disabled?: boolean
label: ReactNode
hint?: ReactNode
}
export const CheckboxSmall = ({
export const Checkbox = ({
name,
label,
className,
disabled = false,
hint,
...props
}: CheckboxSmallProps) => {
}: CheckboxProps) => {
const [field, meta] = useField(name)
return (
<div
Expand Down
14 changes: 7 additions & 7 deletions src/components/PartnerBonusFormSteps.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { BooleanRadio, CheckboxSmall, Input } from './FormComponents'
import { BooleanRadio, Checkbox, Input } from './FormComponents'
import { formatRodneCislo } from '../lib/utils'
import { PartnerBonusFormProps } from './PartnerBonusForm'
import { Details } from './Details'
Expand Down Expand Up @@ -120,32 +120,32 @@ export const ConditionsQuestion = ({ disabled }) => (
Spĺňa vaša manželka / manžel aspoň jednu z podmienok?
</h1>
</legend>
<CheckboxSmall
<Checkbox
name="partner_podmienky.1"
label="Staral/a sa o dieťa do 3 rokov"
disabled={disabled}
/>
<CheckboxSmall
<Checkbox
name="partner_podmienky.2"
label="Staral/a sa o dieťa do 6 rokov s nepriaznivým zdravotným stavom"
disabled={disabled}
/>
<CheckboxSmall
<Checkbox
name="partner_podmienky.3"
label="Poberá príspevok na opatrovanie ťažko zdravotne postihnutého"
disabled={disabled}
/>
<CheckboxSmall
<Checkbox
name="partner_podmienky.4"
label="Poberal/a príspevok na opatrovanie ťažko zdravotne postihnutého"
disabled={disabled}
/>
<CheckboxSmall
<Checkbox
name="partner_podmienky.5"
label="Bol/a evidovaný/á ako uchádzač o zamestnanie"
disabled={disabled}
/>
<CheckboxSmall
<Checkbox
name="partner_podmienky.6"
label="Považuje sa za občana so zdravotným postihnutím alebo s ťažkým zdravotným postihnutím"
disabled={disabled}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/dve-percenta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Link from 'next/link'
import { Form, FormikProps } from 'formik'
import {
BooleanRadio,
CheckboxSmall,
Checkbox,
FormWrapper,
Input,
} from '../components/FormComponents'
Expand Down Expand Up @@ -145,7 +145,7 @@ const DvePercenta: Page<TwoPercentUserInput> = ({
</div>
{props.values.XIIoddiel_uplatnujem2percenta && (
<>
<CheckboxSmall
<Checkbox
name="splnam3per"
label={`spĺňam podmienky na poukázanie 3% z dane (${formatCurrency(calculatedTax.suma_3_percenta.toNumber())})`}
/>
Expand Down Expand Up @@ -205,7 +205,7 @@ const DvePercenta: Page<TwoPercentUserInput> = ({
/>
</div>
<h2 className="govuk-heading-l">Súhlas so zaslaním údajov</h2>
<CheckboxSmall
<Checkbox
name="XIIoddiel_suhlasZaslUdaje"
label="Želám si, aby prijímateľ 2% videl moje údaje (meno, priezvisko a adresa trvalého pobytu)"
/>
Expand Down

0 comments on commit 3095c89

Please sign in to comment.