-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/update-attributions-only-in-no-forks
- Loading branch information
Showing
156 changed files
with
2,622 additions
and
500 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
34 changes: 34 additions & 0 deletions
34
app/component-library/components-temp/CellSelectWithMenu/CellSelectWithMenu.constants.ts
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,34 @@ | ||
// External dependencies. | ||
import { IconName } from '../../../component-library/components/Icons/Icon'; | ||
import { | ||
AvatarVariant, | ||
AvatarAccountType, | ||
} from '../../../component-library/components/Avatars/Avatar'; | ||
import { AvatarProps } from '../../../component-library/components/Avatars/Avatar/Avatar.types'; | ||
|
||
// Internal dependencies. | ||
import { CellSelectWithMenuProps } from './CellSelectWithMenu.types'; | ||
|
||
// Sample consts | ||
const SAMPLE_CELLSELECT_WITH_BUTTON_TITLE = 'Orangefox.eth'; | ||
const SAMPLE_CELLSELECT_WITH_BUTTON_SECONDARYTEXT = | ||
'0x2990079bcdEe240329a520d2444386FC119da21a'; | ||
const SAMPLE_CELLSELECT_WITH_BUTTON_TERTIARY_TEXT = 'Updated 1 sec ago'; | ||
const SAMPLE_CELLSELECT_WITH_BUTTON_TAGLABEL = 'Imported'; | ||
const SAMPLE_CELLSELECT_WITH_BUTTON_AVATARPROPS: AvatarProps = { | ||
variant: AvatarVariant.Account, | ||
accountAddress: '0x2990079bcdEe240329a520d2444386FC119da21a', | ||
type: AvatarAccountType.JazzIcon, | ||
}; | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export const SAMPLE_CELLSELECT_WITH_BUTTON_PROPS: CellSelectWithMenuProps = { | ||
title: SAMPLE_CELLSELECT_WITH_BUTTON_TITLE, | ||
secondaryText: SAMPLE_CELLSELECT_WITH_BUTTON_SECONDARYTEXT, | ||
tertiaryText: SAMPLE_CELLSELECT_WITH_BUTTON_TERTIARY_TEXT, | ||
tagLabel: SAMPLE_CELLSELECT_WITH_BUTTON_TAGLABEL, | ||
avatarProps: SAMPLE_CELLSELECT_WITH_BUTTON_AVATARPROPS, | ||
isSelected: false, | ||
isDisabled: false, | ||
buttonIcon: IconName.MoreVertical, | ||
}; |
41 changes: 41 additions & 0 deletions
41
app/component-library/components-temp/CellSelectWithMenu/CellSelectWithMenu.stories.tsx
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,41 @@ | ||
// Internal dependencies. | ||
import { default as CellSelectWithMenu } from './CellSelectWithMenu'; | ||
import { SAMPLE_CELLSELECT_WITH_BUTTON_PROPS } from './CellSelectWithMenu.constants'; | ||
|
||
const CellSelectWithMenuMeta = { | ||
title: 'Component Library / Cells', | ||
component: CellSelectWithMenu, | ||
argTypes: { | ||
title: { | ||
control: { type: 'text' }, | ||
defaultValue: SAMPLE_CELLSELECT_WITH_BUTTON_PROPS.title, | ||
}, | ||
secondaryText: { | ||
control: { type: 'text' }, | ||
defaultValue: SAMPLE_CELLSELECT_WITH_BUTTON_PROPS.secondaryText, | ||
}, | ||
tertiaryText: { | ||
control: { type: 'text' }, | ||
defaultValue: SAMPLE_CELLSELECT_WITH_BUTTON_PROPS.tertiaryText, | ||
}, | ||
tagLabel: { | ||
control: { type: 'text' }, | ||
defaultValue: SAMPLE_CELLSELECT_WITH_BUTTON_PROPS.tagLabel, | ||
}, | ||
isSelected: { | ||
control: { type: 'boolean' }, | ||
defaultValue: SAMPLE_CELLSELECT_WITH_BUTTON_PROPS.isSelected, | ||
}, | ||
isDisabled: { | ||
control: { type: 'boolean' }, | ||
defaultValue: SAMPLE_CELLSELECT_WITH_BUTTON_PROPS.isDisabled, | ||
}, | ||
}, | ||
}; | ||
export default CellSelectWithMenuMeta; | ||
|
||
export const CellMultiSelectWithMenu = { | ||
args: { | ||
avatarProps: SAMPLE_CELLSELECT_WITH_BUTTON_PROPS.avatarProps, | ||
}, | ||
}; |
35 changes: 35 additions & 0 deletions
35
app/component-library/components-temp/CellSelectWithMenu/CellSelectWithMenu.styles.ts
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 @@ | ||
// Third library dependencies. | ||
import { StyleSheet, ViewStyle } from 'react-native'; | ||
|
||
// External dependencies. | ||
import { CellSelectWithMenuStyleSheetVars } from './CellSelectWithMenu.types'; | ||
|
||
// Internal dependencies. | ||
import { Theme } from '../../../util/theme/models'; | ||
|
||
/** | ||
* Style sheet function for CellSelect component. | ||
* | ||
* @param params Style sheet params. | ||
* @param params.theme App theme from ThemeContext. | ||
* @param params.vars Inputs that the style sheet depends on. | ||
* @returns StyleSheet object. | ||
*/ | ||
const styleSheet = (params: { | ||
theme: Theme; | ||
vars: CellSelectWithMenuStyleSheetVars; | ||
}) => { | ||
const { vars } = params; | ||
const { style } = vars; | ||
|
||
return StyleSheet.create({ | ||
base: Object.assign( | ||
{ | ||
padding: 16, | ||
} as ViewStyle, | ||
style, | ||
) as ViewStyle, | ||
}); | ||
}; | ||
|
||
export default styleSheet; |
24 changes: 24 additions & 0 deletions
24
app/component-library/components-temp/CellSelectWithMenu/CellSelectWithMenu.test.tsx
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,24 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react-native'; | ||
|
||
import CellSelectWithMenu from './CellSelectWithMenu'; | ||
import { CellModalSelectorsIDs } from '../../../../e2e/selectors/Modals/CellModal.selectors'; | ||
|
||
import { SAMPLE_CELLSELECT_WITH_BUTTON_PROPS } from './CellSelectWithMenu.constants'; | ||
|
||
describe('CellSelectWithMenu', () => { | ||
it('should render with default settings correctly', () => { | ||
const wrapper = render( | ||
<CellSelectWithMenu {...SAMPLE_CELLSELECT_WITH_BUTTON_PROPS} />, | ||
); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
|
||
it('should render CellSelectWithMenu', () => { | ||
const { queryByTestId } = render( | ||
<CellSelectWithMenu {...SAMPLE_CELLSELECT_WITH_BUTTON_PROPS} />, | ||
); | ||
// Adjust the testID to match the one used in CellSelectWithMenu, if different | ||
expect(queryByTestId(CellModalSelectorsIDs.MULTISELECT)).not.toBe(null); | ||
}); | ||
}); |
50 changes: 50 additions & 0 deletions
50
app/component-library/components-temp/CellSelectWithMenu/CellSelectWithMenu.tsx
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,50 @@ | ||
/* eslint-disable react/prop-types */ | ||
|
||
// Third library dependencies. | ||
import React from 'react'; | ||
|
||
// External dependencies. | ||
import { useStyles } from '../../hooks'; | ||
import CellBase from '../../../component-library/components/Cells/Cell/foundation/CellBase'; | ||
|
||
// Internal dependencies. | ||
import styleSheet from './CellSelectWithMenu.styles'; | ||
import { CellSelectWithMenuProps } from './CellSelectWithMenu.types'; | ||
import { CellModalSelectorsIDs } from '../../../../e2e/selectors/Modals/CellModal.selectors'; | ||
import ListItemMultiSelectButton from '../ListItemMultiSelectButton/ListItemMultiSelectButton'; | ||
|
||
const CellSelectWithMenu = ({ | ||
style, | ||
avatarProps, | ||
title, | ||
secondaryText, | ||
tertiaryText, | ||
tagLabel, | ||
isSelected = false, | ||
children, | ||
...props | ||
}: CellSelectWithMenuProps) => { | ||
const { styles } = useStyles(styleSheet, { style }); | ||
|
||
return ( | ||
<ListItemMultiSelectButton | ||
isSelected={isSelected} | ||
style={styles.base} | ||
testID={CellModalSelectorsIDs.MULTISELECT} | ||
{...props} | ||
> | ||
<CellBase | ||
avatarProps={avatarProps} | ||
title={title} | ||
secondaryText={secondaryText} | ||
tertiaryText={tertiaryText} | ||
tagLabel={tagLabel} | ||
style={style} | ||
> | ||
{children} | ||
</CellBase> | ||
</ListItemMultiSelectButton> | ||
); | ||
}; | ||
|
||
export default CellSelectWithMenu; |
18 changes: 18 additions & 0 deletions
18
app/component-library/components-temp/CellSelectWithMenu/CellSelectWithMenu.types.ts
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,18 @@ | ||
// External dependencies. | ||
import { CellBaseProps } from '../../../component-library/components/Cells/Cell/foundation/CellBase/CellBase.types'; | ||
import { ListItemMultiSelectButtonProps } from '../ListItemMultiSelectButton/ListItemMultiSelectButton.types'; | ||
|
||
/** | ||
* Cell Account Select component props. | ||
*/ | ||
export interface CellSelectWithMenuProps | ||
extends CellBaseProps, | ||
Omit<ListItemMultiSelectButtonProps, 'children'> {} | ||
|
||
/** | ||
* Style sheet input parameters. | ||
*/ | ||
export type CellSelectWithMenuStyleSheetVars = Pick< | ||
CellSelectWithMenuProps, | ||
'style' | ||
>; |
Oops, something went wrong.