@@ -2,7 +2,7 @@ import React from 'react'
22import ClickableBox from './clickable-box'
33import Text from './text'
44import * as Styles from '../styles'
5- import { Props } from './radio-button'
5+ import type { Props } from './radio-button'
66
77const Kb = {
88 ClickableBox,
@@ -12,43 +12,35 @@ const Kb = {
1212export const RADIOBUTTON_SIZE = 22
1313export const RADIOBUTTON_MARGIN = 8
1414
15- type ExtraProps = { disabled ?: boolean ; selected : boolean }
16- const RadioOuterCircle = Styles . styled ( ClickableBox ) (
17- {
18- backgroundColor : Styles . globalColors . white ,
19- borderRadius : 100 ,
20- borderWidth : 1 ,
21- height : RADIOBUTTON_SIZE ,
22- marginRight : RADIOBUTTON_MARGIN ,
23- position : 'relative' as const ,
24- width : RADIOBUTTON_SIZE ,
25- } ,
26- ( { disabled, selected} : ExtraProps ) => ( {
27- borderColor : selected ? Styles . globalColors . blue : Styles . globalColors . black_20 ,
28- opacity : disabled ? 0.4 : 1 ,
29- } )
15+ const RadioOuterCircle = ( p : { disabled : boolean ; selected : boolean ; children : React . ReactNode } ) => (
16+ < Kb . ClickableBox
17+ style = { Styles . collapseStyles ( [
18+ styles . outer ,
19+ {
20+ borderColor : p . selected ? Styles . globalColors . blue : Styles . globalColors . black_20 ,
21+ opacity : p . disabled ? 0.4 : 1 ,
22+ } ,
23+ ] ) }
24+ >
25+ { p . children }
26+ </ Kb . ClickableBox >
3027)
3128
32- const RadioInnerCircle = Styles . styled ( ClickableBox ) (
33- {
34- borderColor : Styles . globalColors . white ,
35- borderRadius : 10 ,
36- borderWidth : 5 ,
37- left : 5 ,
38- position : 'absolute' ,
39- top : 5 ,
40- } ,
41- ( { selected} : ExtraProps ) => ( {
42- borderColor : selected ? Styles . globalColors . blue : Styles . globalColors . white ,
43- } )
29+ const RadioInnerCircle = ( p : { selected : boolean } ) => (
30+ < Kb . ClickableBox
31+ style = { Styles . collapseStyles ( [
32+ styles . inner ,
33+ { borderColor : p . selected ? Styles . globalColors . blue : Styles . globalColors . white } ,
34+ ] ) }
35+ />
4436)
4537
4638const RadioButton = ( { disabled, label, onSelect, selected, style} : Props ) => (
4739 < Kb . ClickableBox
4840 style = { { ...styles . container , ...style } }
4941 onClick = { disabled ? undefined : ( ) => onSelect ( ! selected ) }
5042 >
51- < RadioOuterCircle disabled = { disabled } selected = { selected } >
43+ < RadioOuterCircle disabled = { disabled ?? false } selected = { selected } >
5244 < RadioInnerCircle selected = { selected } />
5345 </ RadioOuterCircle >
5446 { typeof label === 'string' ? (
@@ -70,6 +62,23 @@ const styles = Styles.styleSheetCreate(
7062 paddingBottom : Styles . globalMargins . xtiny ,
7163 paddingTop : Styles . globalMargins . xtiny ,
7264 } ,
65+ inner : {
66+ borderColor : Styles . globalColors . white ,
67+ borderRadius : 10 ,
68+ borderWidth : 5 ,
69+ left : 5 ,
70+ position : 'absolute' ,
71+ top : 5 ,
72+ } ,
73+ outer : {
74+ backgroundColor : Styles . globalColors . white ,
75+ borderRadius : 100 ,
76+ borderWidth : 1 ,
77+ height : RADIOBUTTON_SIZE ,
78+ marginRight : RADIOBUTTON_MARGIN ,
79+ position : 'relative' as const ,
80+ width : RADIOBUTTON_SIZE ,
81+ } ,
7382 } as const )
7483)
7584
0 commit comments