Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

Commit

Permalink
-added prop interface for the Radio component (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova committed Sep 3, 2018
1 parent a5814f8 commit eb3a8d6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
14 changes: 13 additions & 1 deletion src/components/Radio/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,24 @@ import * as PropTypes from 'prop-types'

import { createHTMLInput, customPropTypes, UIComponent } from '../../lib'
import Label from '../Label'
import { Extendable, ReactChildren } from '../../../types/utils'
import { ComponentVariablesInput, IComponentPartStylesInput } from '../../../types/theme'

export interface IRadioProps {
as?: any
children?: ReactChildren
className?: string
label?: string
type?: string
styles?: IComponentPartStylesInput
variables?: ComponentVariablesInput
}

/**
* @accessibility
* This is shown at the top.
*/
class Radio extends UIComponent<any, any> {
class Radio extends UIComponent<Extendable<IRadioProps>, any> {
static displayName = 'Radio'

static className = 'ui-radio'
Expand Down
7 changes: 4 additions & 3 deletions src/themes/teams/components/Radio/radioStyles.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { IComponentPartStylesInput, ICSSInJSStyle } from '../../../../../types/theme'
import { IRadioProps } from '../../../../components/Radio/Radio'

const radioStyles: IComponentPartStylesInput = {
root: ({ props, variables }): ICSSInJSStyle => {
root: (): ICSSInJSStyle => {
return {
outline: 0,
display: 'inline-block',
}
},

radio: ({ props, variables }): ICSSInJSStyle => {
radio: ({ variables }: { props: IRadioProps; variables: any }): ICSSInJSStyle => {
return {
marginRight: variables.radioMargin,
}
},

label: ({ props, variables }): ICSSInJSStyle => {
label: ({ variables }: { props: IRadioProps; variables: any }): ICSSInJSStyle => {
return {
cursor: 'pointer',
display: 'inline-flex',
Expand Down

0 comments on commit eb3a8d6

Please sign in to comment.