-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6791 from Expensify/marcaaron-selectCircle
Add SelectCircle replace usage in OptionsRow and makes MenuItem selectable
- Loading branch information
Showing
5 changed files
with
77 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import PropTypes from 'prop-types'; | ||
import styles from '../styles/styles'; | ||
import Icon from './Icon'; | ||
import * as Expensicons from './Icon/Expensicons'; | ||
import themeColors from '../styles/themes/default'; | ||
|
||
const propTypes = { | ||
/** Should we show the checkmark inside the circle */ | ||
isChecked: PropTypes.bool, | ||
}; | ||
|
||
const defaultProps = { | ||
isChecked: false, | ||
}; | ||
|
||
const SelectCircle = props => ( | ||
<View style={[styles.selectCircle, styles.alignSelfCenter]}> | ||
{props.isChecked && ( | ||
<Icon src={Expensicons.Checkmark} fill={themeColors.iconSuccessFill} /> | ||
)} | ||
</View> | ||
); | ||
|
||
SelectCircle.propTypes = propTypes; | ||
SelectCircle.defaultProps = defaultProps; | ||
SelectCircle.displayName = 'SelectCircle'; | ||
|
||
export default SelectCircle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import MenuItem from '../components/MenuItem'; | ||
import Chase from '../../assets/images/bankicons/chase.svg'; | ||
import variables from '../styles/variables'; | ||
|
||
/** | ||
* We use the Component Story Format for writing stories. Follow the docs here: | ||
* | ||
* https://storybook.js.org/docs/react/writing-stories/introduction#component-story-format | ||
*/ | ||
const story = { | ||
title: 'Components/MenuItem', | ||
component: MenuItem, | ||
}; | ||
|
||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
const Template = args => <MenuItem {...args} />; | ||
|
||
// Arguments can be passed to the component by binding | ||
// See: https://storybook.js.org/docs/react/writing-stories/introduction#using-args | ||
const Default = Template.bind({}); | ||
Default.args = { | ||
title: 'Alberta Bobbeth Charleson', | ||
description: 'Account ending in 1111', | ||
shouldShowSelectedState: true, | ||
isSelected: true, | ||
icon: Chase, | ||
iconHeight: variables.iconSizeExtraLarge, | ||
iconWidth: variables.iconSizeExtraLarge, | ||
}; | ||
|
||
export default story; | ||
export { | ||
Default, | ||
}; |