Skip to content

Commit

Permalink
make discard changes red; fix issue with same value radio input
Browse files Browse the repository at this point in the history
  • Loading branch information
jinkang-0 committed May 21, 2024
1 parent 48b65f7 commit cfcbee2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/app/onboarding/legal-credentials/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export default function Page() {
</FormLabel>
<FormControl>
<RadioGroup
name="registered"
name="eoirRegistered"
defaultValue={formatTruthy(
field.value,
'Yes',
Expand Down
3 changes: 2 additions & 1 deletion src/components/Buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ interface ButtonProps {
const ButtonStyles = css<ButtonProps>`
${sans.style}
appearance: none;
color: ${({ $primaryColor }) => ($primaryColor ? 'white' : COLORS.blueMid)};
color: ${({ $primaryColor, $secondaryColor }) =>
$primaryColor ? 'white' : $secondaryColor || COLORS.blueMid};
background: ${({ $primaryColor }) => $primaryColor || 'white'};
padding: 10px 20px;
border-radius: 5px;
Expand Down
8 changes: 4 additions & 4 deletions src/components/RadioGroup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ export default function RadioGroup({
)}
<GroupContainer>
{options.map(o => (
<RadioLabel key={o} htmlFor={o}>
<RadioLabel key={o} htmlFor={`${name}${o}`}>
<RadioInput
type="radio"
id={o}
id={`${name}${o}`}
name={name}
value={value}
checked={value ? value === o : undefined}
value={`${name}${o}`}
checked={value ? value === `${name}${o}` : undefined}
defaultChecked={defaultValue === o}
onChange={() => handleChange(o)}
/>
Expand Down
8 changes: 7 additions & 1 deletion src/components/SettingsSection/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createContext, useContext, useMemo } from 'react';
import { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';
import COLORS from '@/styles/colors';
import { Flex } from '@/styles/containers';
import { Spinner } from '@/styles/spinner';
import { H2, P } from '@/styles/text';
Expand Down Expand Up @@ -54,7 +55,12 @@ export function SettingSection({

{isEditing ? (
<Flex $gap="1.25rem" $justify="end">
<Button type="button" onClick={() => cancelEdit?.()}>
<Button
type="button"
$secondaryColor={COLORS.redDark}
$tertiaryColor={COLORS.redDarker}
onClick={() => cancelEdit?.()}
>
Discard Changes
</Button>
<BlueButton type="submit" disabled={isSubmitting}>
Expand Down

0 comments on commit cfcbee2

Please sign in to comment.