Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Cards): add role prop for touchable cards #1169

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/__type_tests__/card-type-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Image from '../image';
<SnapCard title="title" href="/" />;
<SnapCard title="title" to="/" />;
<SnapCard title="title" onPress={() => {}} />;
<SnapCard title="title" onPress={() => {}} trackingEvent={{name: 'do-something'}} />;
<SnapCard title="title" onPress={() => {}} trackingEvent={{name: 'do-something'}} role="link" />;
// @ts-expect-error onPress and href can't be used together
<SnapCard title="title" onPress={() => {}} href="/" />;
// @ts-expect-error onPress and to can't be used together
Expand All @@ -31,6 +31,7 @@ import Image from '../image';
title="title"
onPress={() => {}}
trackingEvent={{name: 'do-something'}}
role="link"
/>;
<PosterCard title="title" isInverse />;
<PosterCard title="title" variant="inverse" />;
Expand Down Expand Up @@ -75,6 +76,7 @@ import Image from '../image';
title="title"
onPress={() => {}}
trackingEvent={{name: 'do-something'}}
role="link"
/>;
// @ts-expect-error onPress and href can't be used together
<NakedCard media={<Image src="/something.png" />} title="title" onPress={() => {}} href="/" />;
Expand All @@ -94,6 +96,7 @@ import Image from '../image';
title="title"
onPress={() => {}}
trackingEvent={{name: 'do-something'}}
role="link"
/>;
// @ts-expect-error onPress and href can't be used together
<SmallNakedCard media={<Image src="/something.png" />} title="title" onPress={() => {}} href="/" />;
Expand Down
1 change: 1 addition & 0 deletions src/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ const CardContent: React.FC<CardContentProps> = ({

type TouchableProps = {
trackingEvent?: TrackingEvent | ReadonlyArray<TrackingEvent>;
role?: string;
} & ExclusifyUnion<
| {
href: string | undefined;
Expand Down
1 change: 1 addition & 0 deletions src/community/advanced-data-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import type {

type TouchableProps = {
trackingEvent?: TrackingEvent | ReadonlyArray<TrackingEvent>;
role?: string;
} & ExclusifyUnion<
| {
href: string | undefined;
Expand Down
Loading