Skip to content

Commit

Permalink
Change whatsNewList to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Cal-L committed Jun 8, 2022
1 parent b789421 commit 872a2dc
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions app/components/UI/WhatsNewModal/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { ImageSourcePropType } from 'react-native';

interface SlideImage {
type: 'image';
image: ImageSourcePropType;
}

interface SlideTitle {
type: 'title';
title: string;
}

interface SlideDescription {
type: 'description';
description: string;
}

type SlideButtonType = 'normal' | 'blue';

interface SlideButton {
type: 'button';
buttonType: SlideButtonType;
buttonText: string;
onPress: (props: { navigation: any }) => void;
}

type SlideContentType =
| SlideImage
| SlideTitle
| SlideDescription
| SlideButton;

type WhatsNewSlides = SlideContentType[][];

export interface WhatsNew {
onlyUpdates: boolean;
maxLastAppVersion: string;
minAppVersion: string;
/**
* Slides utilizes a templating system in the form of a 2D array, which is eventually rendered within app/components/UI/WhatsNewModal/index.js.
* The root layer determines the number of slides. Ex. To display 3 slides, the root layer should contain 3 arrays.
* The inner layer determines the content that will be rendered within each slide.
* The slide content takes the form of union types, where the possible types are `image`, `title`, `description`, or `button`.
* Both slide count and slide content will be rendered in the same order as the data set.
*/
slides: WhatsNewSlides;
}

0 comments on commit 872a2dc

Please sign in to comment.