-
-
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.
Added horizontalAlignment to Accordions
- Loading branch information
1 parent
555d8cc
commit 62f87c9
Showing
16 changed files
with
225 additions
and
113 deletions.
There are no files selected for viewing
15 changes: 12 additions & 3 deletions
15
app/component-library/components/Accordions/Accordion/Accordion.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 |
---|---|---|
@@ -1,5 +1,14 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export const ACCORDION_EXPAND_TRANSITION_DURATION = 150; | ||
// External dependencies. | ||
import { AnimationDuration } from '../../../constants/animation.constants'; | ||
import { SAMPLE_ACCORDIONHEADER_TITLE } from './foundation/AccordionHeader/AccordionHeader.constants'; | ||
|
||
export const ACCORDION_TEST_ID = 'accordion'; | ||
export const ACCORDION_CONTENT_TEST_ID = 'accordion-content'; | ||
// Test IDs | ||
export const TESTID_ACCORDION = 'accordion'; | ||
export const TESTID_ACCORDION_CONTENT = 'accordion-content'; | ||
|
||
// Defaults | ||
export const DEFAULT_ACCORDION_EXPANDDURATION = AnimationDuration.Promptly; | ||
|
||
// Samples | ||
export const SAMPLE_ACCORDION_TITLE = SAMPLE_ACCORDIONHEADER_TITLE; |
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
5 changes: 1 addition & 4 deletions
5
app/component-library/components/Accordions/Accordion/Accordion.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
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
18 changes: 8 additions & 10 deletions
18
app/component-library/components/Accordions/Accordion/__snapshots__/Accordion.test.tsx.snap
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 |
---|---|---|
@@ -1,32 +1,30 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Accordion - Snapshot should render a proper expanded state 1`] = ` | ||
<View | ||
style={Object {}} | ||
testID="accordion" | ||
> | ||
<Fragment> | ||
<AccordionHeader | ||
isExpanded={true} | ||
onPress={[Function]} | ||
style={Object {}} | ||
testID="accordion" | ||
title="Sample Accordion Header Title" | ||
/> | ||
<View | ||
testID="accordion-content" | ||
> | ||
<View /> | ||
</View> | ||
</View> | ||
</Fragment> | ||
`; | ||
|
||
exports[`Accordion - Snapshot should render default settings correctly 1`] = ` | ||
<View | ||
style={Object {}} | ||
testID="accordion" | ||
> | ||
<Fragment> | ||
<AccordionHeader | ||
isExpanded={false} | ||
onPress={[Function]} | ||
style={Object {}} | ||
testID="accordion" | ||
title="Sample Accordion Header Title" | ||
/> | ||
</View> | ||
</Fragment> | ||
`; |
34 changes: 27 additions & 7 deletions
34
...y/components/Accordions/Accordion/foundation/AccordionHeader/AccordionHeader.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 |
---|---|---|
@@ -1,9 +1,29 @@ | ||
/* eslint-disable no-console */ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export const TEST_ACCORDION_HEADER_TITLE = 'Sample Accordion Header Title'; | ||
// Internal dependencies. | ||
import { | ||
AccordionHeaderHorizontalAlignment, | ||
AccordionHeaderProps, | ||
} from './AccordionHeader.types'; | ||
|
||
export const ACCORDION_HEADER_TEST_ID = 'accordion-header'; | ||
export const ACCORDION_HEADER_TITLE_TEST_ID = 'accordion-header-title'; | ||
export const ACCORDION_HEADER_ARROW_ICON_TEST_ID = | ||
'accordion-header-arrow-icon'; | ||
export const ACCORDION_HEADER_ARROW_ICON_ANIMATION_TEST_ID = | ||
'accordion-header-arrow-icon-animation'; | ||
// Defaults | ||
export const DEFAULT_ACCORDIONHEADER_HORIZONTALALIGNMENT = | ||
AccordionHeaderHorizontalAlignment.Center; | ||
|
||
// Test IDs | ||
export const TESTID_ACCORDIONHEADER = 'accordionheader'; | ||
export const TESTID_ACCORDIONHEADER_TITLE = 'accordionheader-title'; | ||
export const TESTID_ACCORDIONHEADER_ARROWICON = 'accordionheader-arrow-icon'; | ||
export const TESTID_ACCORDIONHEADER_ARROWICON_ANIMATION = | ||
'accordionheader-arrow-icon-animation'; | ||
|
||
// Sample consts | ||
export const SAMPLE_ACCORDIONHEADER_TITLE = 'Sample Accordion Header Title'; | ||
export const SAMPLE_ACCORDIONHEADER_PROPS: AccordionHeaderProps = { | ||
title: SAMPLE_ACCORDIONHEADER_TITLE, | ||
onPress: () => { | ||
console.log('Accordion Header clicked'); | ||
}, | ||
isExpanded: false, | ||
horizontalAlignment: DEFAULT_ACCORDIONHEADER_HORIZONTALALIGNMENT, | ||
}; |
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
Oops, something went wrong.