diff --git a/app/component-library/components-temp/Accounts/AccountBalance/AccountBalance.tsx b/app/component-library/components-temp/Accounts/AccountBalance/AccountBalance.tsx index e39db5c3485..2c0a7f1f7dd 100644 --- a/app/component-library/components-temp/Accounts/AccountBalance/AccountBalance.tsx +++ b/app/component-library/components-temp/Accounts/AccountBalance/AccountBalance.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { AccountBalanceProps } from './AccountBalance.types'; -import CellDisplayContainer from '../../../components/Cells/Cell/foundation/CellDisplayContainer'; +import Card from '../../../components/Cards/Card'; import AccountBase from '../AccountBase/AccountBase'; import { ACCOUNT_BALANCE_TEST_ID } from './AccountBalance.constants'; import styles from './AccountBalance.styles'; @@ -14,10 +14,7 @@ const AccountBalance = ({ accountAddress, badgeProps, }: AccountBalanceProps) => ( - + - + ); export default AccountBalance; diff --git a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.stories.tsx b/app/component-library/components/Cards/Card/Card.stories.tsx similarity index 68% rename from app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.stories.tsx rename to app/component-library/components/Cards/Card/Card.stories.tsx index 8070fcea97d..4d25f00d883 100644 --- a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.stories.tsx +++ b/app/component-library/components/Cards/Card/Card.stories.tsx @@ -6,16 +6,16 @@ import { View } from 'react-native'; import { storiesOf } from '@storybook/react-native'; // External dependencies. -import { mockTheme } from '../../../../../../util/theme'; -import Text, { TextVariant } from '../../../../Texts/Text'; +import { mockTheme } from '../../../../util/theme'; +import Text, { TextVariant } from '../../Texts/Text'; // Internal dependencies. -import CellDisplayContainer from './CellDisplayContainer'; +import Card from './Card'; -storiesOf('Component Library / CellDisplayContainer', module) +storiesOf('Component Library / Card', module) .addDecorator((getStory) => getStory()) .add('Default', () => ( - + {'Wrapped Content'} - + )); diff --git a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.styles.ts b/app/component-library/components/Cards/Card/Card.styles.ts similarity index 70% rename from app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.styles.ts rename to app/component-library/components/Cards/Card/Card.styles.ts index 3dcdc61b50d..c6fb17a319c 100644 --- a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.styles.ts +++ b/app/component-library/components/Cards/Card/Card.styles.ts @@ -2,23 +2,20 @@ import { StyleSheet, ViewStyle } from 'react-native'; // External dependencies. -import { Theme } from '../../../../../../util/theme/models'; +import { Theme } from '../../../../util/theme/models'; // Internal dependencies. -import { CellDisplayContainerStyleSheetVars } from './CellDisplayContainer.types'; +import { CardStyleSheetVars } from './Card.types'; /** - * Style sheet function for CellDisplayContainer component. + * Style sheet function for Card 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: CellDisplayContainerStyleSheetVars; -}) => { +const styleSheet = (params: { theme: Theme; vars: CardStyleSheetVars }) => { const { vars, theme } = params; const { colors } = theme; const { style } = vars; diff --git a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.test.tsx b/app/component-library/components/Cards/Card/Card.test.tsx similarity index 63% rename from app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.test.tsx rename to app/component-library/components/Cards/Card/Card.test.tsx index cf5755b6b56..5bf0913416b 100644 --- a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.test.tsx +++ b/app/component-library/components/Cards/Card/Card.test.tsx @@ -4,14 +4,14 @@ import { View } from 'react-native'; import { shallow } from 'enzyme'; // Internal dependencies. -import CellDisplayContainer from './CellDisplayContainer'; +import Card from './Card'; -describe('CellDisplayContainer - Snapshot', () => { +describe('Card - Snapshot', () => { it('should render correctly', () => { const wrapper = shallow( - + - , + , ); expect(wrapper).toMatchSnapshot(); }); diff --git a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.tsx b/app/component-library/components/Cards/Card/Card.tsx similarity index 50% rename from app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.tsx rename to app/component-library/components/Cards/Card/Card.tsx index 68853b0f731..f9a955ab1c3 100644 --- a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.tsx +++ b/app/component-library/components/Cards/Card/Card.tsx @@ -5,17 +5,13 @@ import React from 'react'; import { View } from 'react-native'; // External dependencies. -import { useStyles } from '../../../../../hooks'; +import { useStyles } from '../../../hooks'; // Internal dependencies. -import styleSheet from './CellDisplayContainer.styles'; -import { CellDisplayContainerProps } from './CellDisplayContainer.types'; +import styleSheet from './Card.styles'; +import { CardProps } from './Card.types'; -const CellDisplayContainer: React.FC = ({ - style, - children, - ...props -}) => { +const Card: React.FC = ({ style, children, ...props }) => { const { styles } = useStyles(styleSheet, { style }); return ( @@ -25,4 +21,4 @@ const CellDisplayContainer: React.FC = ({ ); }; -export default CellDisplayContainer; +export default Card; diff --git a/app/component-library/components/Cards/Card/Card.types.ts b/app/component-library/components/Cards/Card/Card.types.ts new file mode 100644 index 00000000000..b2590017861 --- /dev/null +++ b/app/component-library/components/Cards/Card/Card.types.ts @@ -0,0 +1,17 @@ +// Third party dependencies. +import { ViewProps } from 'react-native'; + +/** + * Card component props. + */ +export interface CardProps extends ViewProps { + /** + * Content to wrap to display. + */ + children: React.ReactNode; +} + +/** + * Style sheet input parameters. + */ +export type CardStyleSheetVars = Pick; diff --git a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/README.md b/app/component-library/components/Cards/Card/README.md similarity index 61% rename from app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/README.md rename to app/component-library/components/Cards/Card/README.md index 84386a0744c..c41c5abd2c2 100644 --- a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/README.md +++ b/app/component-library/components/Cards/Card/README.md @@ -1,6 +1,6 @@ -# CellAccountDisplayItemContainer +# Card -CellAccountDisplayItemContainer is a wrapper component typically used for displaying CellAccount Content. +Card is a wrapper component typically used for displaying Card Content. ## Props @@ -18,9 +18,9 @@ Content to wrap to display. ```javascript // Replace import with relative path. -import CellAccountDisplayItemContainer from 'app/component-library/components/Cells/CellAccountDisplayItemContainer/CellAccountDisplayItemContainer'; +import Card from 'app/component-library/components/Cards/Card/Card'; - + -; +; ``` diff --git a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/__snapshots__/CellDisplayContainer.test.tsx.snap b/app/component-library/components/Cards/Card/__snapshots__/Card.test.tsx.snap similarity index 77% rename from app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/__snapshots__/CellDisplayContainer.test.tsx.snap rename to app/component-library/components/Cards/Card/__snapshots__/Card.test.tsx.snap index 780ca224b2c..ff0e960c1b8 100644 --- a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/__snapshots__/CellDisplayContainer.test.tsx.snap +++ b/app/component-library/components/Cards/Card/__snapshots__/Card.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`CellDisplayContainer - Snapshot should render correctly 1`] = ` +exports[`Card - Snapshot should render correctly 1`] = ` { const { style } = vars; return StyleSheet.create({ - base: Object.assign({} as ViewStyle, style) as ViewStyle, - cellBase: { - flexDirection: 'row', - }, + cellBase: Object.assign( + { + flexDirection: 'row', + } as ViewStyle, + style, + ) as ViewStyle, avatar: { marginRight: 16, }, diff --git a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.types.ts b/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.types.ts deleted file mode 100644 index 9fa638d4a0d..00000000000 --- a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.types.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Third party dependencies. -import { ViewProps } from 'react-native'; - -/** - * CellDisplayContainer component props. - */ -export interface CellDisplayContainerProps extends ViewProps { - /** - * Content to wrap to display. - */ - children: React.ReactNode; -} - -/** - * Style sheet input parameters. - */ -export type CellDisplayContainerStyleSheetVars = Pick< - CellDisplayContainerProps, - 'style' ->; diff --git a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/index.ts b/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/index.ts deleted file mode 100644 index e1a62f64690..00000000000 --- a/app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './CellDisplayContainer'; diff --git a/app/component-library/components/Cells/Cell/variants/CellDisplay/CellDisplay.tsx b/app/component-library/components/Cells/Cell/variants/CellDisplay/CellDisplay.tsx index 2b55dc5d886..595c14ad582 100644 --- a/app/component-library/components/Cells/Cell/variants/CellDisplay/CellDisplay.tsx +++ b/app/component-library/components/Cells/Cell/variants/CellDisplay/CellDisplay.tsx @@ -6,7 +6,7 @@ import React from 'react'; // External dependencies. import { useStyles } from '../../../../../hooks'; import CellBase from '../../foundation/CellBase'; -import CellDisplayContainer from '../../foundation/CellDisplayContainer'; +import Card from '../../../../Cards/Card'; // Internal dependencies. import { CELL_DISPLAY_TEST_ID } from './CellDisplay.constants'; @@ -25,7 +25,7 @@ const CellDisplay = ({ const { styles } = useStyles(styleSheet, { style }); return ( - + {children} - + ); }; diff --git a/app/component-library/components/Cells/Cell/variants/CellDisplay/__snapshots__/CellDisplay.test.tsx.snap b/app/component-library/components/Cells/Cell/variants/CellDisplay/__snapshots__/CellDisplay.test.tsx.snap index 21aec29d297..7045a72d473 100644 --- a/app/component-library/components/Cells/Cell/variants/CellDisplay/__snapshots__/CellDisplay.test.tsx.snap +++ b/app/component-library/components/Cells/Cell/variants/CellDisplay/__snapshots__/CellDisplay.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`CellDisplay - Snapshot should render default settings correctly 1`] = ` - @@ -15,5 +15,5 @@ exports[`CellDisplay - Snapshot should render default settings correctly 1`] = ` } title="Orangefox.eth" /> - + `; diff --git a/storybook/storyLoader.js b/storybook/storyLoader.js index 9646e81cdaf..a0f1dec18e2 100644 --- a/storybook/storyLoader.js +++ b/storybook/storyLoader.js @@ -31,9 +31,9 @@ function loadStories() { require('../app/component-library/components/Buttons/ButtonPrimary/ButtonPrimary.stories'); require('../app/component-library/components/Buttons/ButtonSecondary/ButtonSecondary.stories'); require('../app/component-library/components/Buttons/ButtonTertiary/ButtonTertiary.stories'); + require('../app/component-library/components/Cards/Card/Card.stories'); require('../app/component-library/components/Cells/Cell/Cell.stories'); require('../app/component-library/components/Cells/Cell/foundation/CellBase/CellBase.stories'); - require('../app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.stories'); require('../app/component-library/components/Cells/Cell/variants/CellDisplay/CellDisplay.stories'); require('../app/component-library/components/Cells/Cell/variants/CellMultiselect/CellMultiselect.stories'); require('../app/component-library/components/Cells/Cell/variants/CellSelect/CellSelect.stories'); @@ -84,9 +84,9 @@ const stories = [ '../app/component-library/components/Buttons/ButtonPrimary/ButtonPrimary.stories', '../app/component-library/components/Buttons/ButtonSecondary/ButtonSecondary.stories', '../app/component-library/components/Buttons/ButtonTertiary/ButtonTertiary.stories', + '../app/component-library/components/Cards/Card/Card.stories', '../app/component-library/components/Cells/Cell/Cell.stories', '../app/component-library/components/Cells/Cell/foundation/CellBase/CellBase.stories', - '../app/component-library/components/Cells/Cell/foundation/CellDisplayContainer/CellDisplayContainer.stories', '../app/component-library/components/Cells/Cell/variants/CellDisplay/CellDisplay.stories', '../app/component-library/components/Cells/Cell/variants/CellMultiselect/CellMultiselect.stories', '../app/component-library/components/Cells/Cell/variants/CellSelect/CellSelect.stories',