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

feat(Radio): add props interface #174

Merged
merged 1 commit into from
Sep 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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