Skip to content

Commit

Permalink
feat #91 - Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Sep 19, 2020
1 parent c37b21b commit b12e4fb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/components/Form/FormRadioGroup/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BaseFieldProps } from '../types'
import FieldLabel from '../FieldLabel'
import { getFormFieldDataTag } from '../utils'
import { Controller, useFormContext } from 'react-hook-form'
import FieldContext, { FieldContextProps } from '../FieldContext'
import RadioGroup, { RadioGroupProps } from '../../RadioGroup'
Expand Down Expand Up @@ -43,6 +44,7 @@ const FormRadioGroup: FC<FormRadioGroupProps> = ({
name={name}
render={({ onChange, value }) => (
<RadioGroup
dataTag={getFormFieldDataTag(name)}
defaultValue={defaultValue}
loading={loading}
onChange={(
Expand Down
9 changes: 7 additions & 2 deletions src/components/RadioGroup/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import 'antd/lib/radio/style/index.css'
import { Radio as AntDRadio } from 'antd'
import { CommonComponentProps } from '../types'
import { createUseStyles } from 'react-jss'
import Skeleton from '../Skeleton'
import { skeletonButtonBorderColor } from '../assets/styleguide'
import times from 'lodash/times'
import { getDataTestAttributeProp, TAG } from '../utils'
import React, { ChangeEventHandler, FC } from 'react'

const useStyles = createUseStyles({
button: {
border: '1px solid #DFDFDF',
border: `1px solid ${skeletonButtonBorderColor}`,
display: 'flex'
},
container: {
Expand Down Expand Up @@ -44,7 +47,7 @@ export interface RadioGroupOptions {
value: string
}

export interface RadioGroupProps {
export interface RadioGroupProps extends CommonComponentProps {
/**
* Default value for radio group. Without this, the first option will be defaulted
*/
Expand Down Expand Up @@ -76,6 +79,7 @@ export interface RadioGroupProps {
const RadioGroup: FC<RadioGroupProps> = (props: RadioGroupProps) => {
const {
defaultValue,
dataTag,
disabled = false,
loading = false,
onChange,
Expand All @@ -99,6 +103,7 @@ const RadioGroup: FC<RadioGroupProps> = (props: RadioGroupProps) => {
buttonStyle='solid'
defaultValue={defaultValue || options[0].value}
disabled={disabled}
name={getDataTestAttributeProp('radioGroup', dataTag)[TAG]}
optionType='button'
options={options}
{...controlledCmpProps}
Expand Down
1 change: 1 addition & 0 deletions src/components/assets/styleguide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ export const fieldErrorStyles = {
}
export const fontSizeRegular = '14px'
export const linkColor = '#1EA7FD'
export const skeletonButtonBorderColor = '#DFDFDF'

0 comments on commit b12e4fb

Please sign in to comment.