Merge pull request 'feature/landing-stubs 0.1.0 (#33)' (#34) from feature/landing-stubs into main
All checks were successful
it-academy/dry-wash-pl/pipeline/head This commit looks good
All checks were successful
it-academy/dry-wash-pl/pipeline/head This commit looks good
Reviewed-on: #34 Reviewed-by: Primakov Alexandr Alexandrovich <primakovpro@gmail.com>
This commit is contained in:
commit
52bb3790c7
13
README.md
13
README.md
@ -45,10 +45,12 @@
|
|||||||
### MVP1
|
### MVP1
|
||||||
|
|
||||||
**1. Landing**
|
**1. Landing**
|
||||||
|
|
||||||
- преимущества сервиса
|
- преимущества сервиса
|
||||||
- оставить заявку (редирект на Страницу оформления заказа)
|
- оставить заявку (редирект на Страницу оформления заказа)
|
||||||
|
|
||||||
**2. Страница для оформления заказа**
|
**2. Страница для оформления заказа**
|
||||||
|
|
||||||
- форма
|
- форма
|
||||||
- номер машины (mask input)
|
- номер машины (mask input)
|
||||||
- цвет машины
|
- цвет машины
|
||||||
@ -58,10 +60,12 @@
|
|||||||
- после заполнения редирект на страницу с деталями заказа
|
- после заполнения редирект на страницу с деталями заказа
|
||||||
|
|
||||||
**3. Страница с деталями заказа**
|
**3. Страница с деталями заказа**
|
||||||
|
|
||||||
- описание заказа
|
- описание заказа
|
||||||
- детали заказа (id, статус)
|
- детали заказа (id, статус)
|
||||||
|
|
||||||
**3. АРМ оператора**
|
**3. АРМ оператора**
|
||||||
|
|
||||||
- список заказов (RUD)
|
- список заказов (RUD)
|
||||||
- id заказа
|
- id заказа
|
||||||
- статус заказа (готово / не готово)
|
- статус заказа (готово / не готово)
|
||||||
@ -72,7 +76,6 @@
|
|||||||
- кнопка "Добавить"
|
- кнопка "Добавить"
|
||||||
- кнопка "Удалить"
|
- кнопка "Удалить"
|
||||||
|
|
||||||
|
|
||||||
### Built With
|
### Built With
|
||||||
|
|
||||||
[![React][React.js]][React-url]
|
[![React][React.js]][React-url]
|
||||||
@ -103,6 +106,14 @@
|
|||||||
|
|
||||||
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
||||||
|
|
||||||
|
## Instructions
|
||||||
|
### Stubs types generation
|
||||||
|
1. generate types with json-literal-typer (should be installed globally)
|
||||||
|
```sh
|
||||||
|
npx json-literal-typer -i <path to json> -o <path to output ts-file>
|
||||||
|
```
|
||||||
|
2. export default type from output file
|
||||||
|
|
||||||
<!-- PARTICIPANTS -->
|
<!-- PARTICIPANTS -->
|
||||||
|
|
||||||
## Participants
|
## Participants
|
||||||
|
14
package-lock.json
generated
14
package-lock.json
generated
@ -6964,20 +6964,6 @@
|
|||||||
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
|
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/fsevents": {
|
|
||||||
"version": "2.3.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
|
||||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
|
||||||
"hasInstallScript": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/function-bind": {
|
"node_modules/function-bind": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||||
|
@ -1,52 +1,29 @@
|
|||||||
import React, { FC } from 'react';
|
import React, { FC } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import {
|
|
||||||
MdEco,
|
|
||||||
MdMiscellaneousServices,
|
|
||||||
MdPlace,
|
|
||||||
MdHandshake,
|
|
||||||
} from 'react-icons/md';
|
|
||||||
import { Heading, HStack, List, Text, VStack } from '@chakra-ui/react';
|
import { Heading, HStack, List, Text, VStack } from '@chakra-ui/react';
|
||||||
|
|
||||||
import { CtaButton, PageSection } from '../';
|
import { CtaButton, PageSection } from '../';
|
||||||
|
|
||||||
import { ListItem } from './ListItem';
|
import { ListItem } from './ListItem';
|
||||||
|
import { BenefitsSectionProps } from './types';
|
||||||
|
import { iconsMap } from './helper';
|
||||||
|
|
||||||
export const BenefitsSection: FC = () => {
|
export const BenefitsSection: FC<BenefitsSectionProps> = ({
|
||||||
const { t } = useTranslation('~', {
|
data: { heading, description, list } = {},
|
||||||
keyPrefix: 'dry-wash.landing.benefits-section',
|
}) => {
|
||||||
});
|
const { t } = useTranslation('~', { keyPrefix: 'dry-wash.landing' });
|
||||||
|
|
||||||
const listData = [
|
|
||||||
{
|
|
||||||
Icon: MdEco,
|
|
||||||
children: t('list.0'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Icon: MdMiscellaneousServices,
|
|
||||||
children: t('list.1'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Icon: MdPlace,
|
|
||||||
children: t('list.2'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Icon: MdHandshake,
|
|
||||||
children: t('list.3'),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageSection>
|
<PageSection>
|
||||||
<VStack w='full' spacing={2}>
|
<VStack w='full' spacing={2}>
|
||||||
<Heading as='h2'>{t('heading')}</Heading>
|
<Heading as='h2'>{t(heading)}</Heading>
|
||||||
<Text>
|
<Text>{t(description)}</Text>
|
||||||
{t('description')}
|
|
||||||
</Text>
|
|
||||||
</VStack>
|
</VStack>
|
||||||
<List display='flex' flexDirection='column' spacing={3}>
|
<List display='flex' flexDirection='column' spacing={3}>
|
||||||
{listData.map((props, i) => (
|
{list.map((itemKey, i) => (
|
||||||
<ListItem key={i} {...props} />
|
<ListItem key={i} Icon={iconsMap[itemKey]}>
|
||||||
|
{t(itemKey)}
|
||||||
|
</ListItem>
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
<HStack w='full' justify='flex-end'>
|
<HStack w='full' justify='flex-end'>
|
||||||
|
13
src/components/landing/BenefitsSection/helper.ts
Normal file
13
src/components/landing/BenefitsSection/helper.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { IconType } from "react-icons";
|
||||||
|
import { MdEco, MdMiscellaneousServices, MdPlace, MdHandshake } from "react-icons/md";
|
||||||
|
|
||||||
|
import { ArrElement } from "../../../lib";
|
||||||
|
|
||||||
|
import { BenefitsList } from "./types";
|
||||||
|
|
||||||
|
export const iconsMap: Record<ArrElement<BenefitsList>, IconType> = {
|
||||||
|
"benefits-section.list.0": MdEco,
|
||||||
|
"benefits-section.list.1": MdMiscellaneousServices,
|
||||||
|
"benefits-section.list.2": MdPlace,
|
||||||
|
"benefits-section.list.3": MdHandshake,
|
||||||
|
};
|
@ -1 +1,2 @@
|
|||||||
|
export type { BenefitsSectionProps } from './types';
|
||||||
export { BenefitsSection } from './BenefitsSection';
|
export { BenefitsSection } from './BenefitsSection';
|
14
src/components/landing/BenefitsSection/types.ts
Normal file
14
src/components/landing/BenefitsSection/types.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
export type BenefitsList = [
|
||||||
|
'benefits-section.list.0',
|
||||||
|
'benefits-section.list.1',
|
||||||
|
'benefits-section.list.2',
|
||||||
|
'benefits-section.list.3',
|
||||||
|
];
|
||||||
|
|
||||||
|
export type BenefitsSectionProps = {
|
||||||
|
data: {
|
||||||
|
heading: 'benefits-section.heading';
|
||||||
|
description: 'benefits-section.description';
|
||||||
|
list: BenefitsList;
|
||||||
|
};
|
||||||
|
};
|
@ -6,7 +6,7 @@ import { ButtonProps, Button } from '@chakra-ui/react';
|
|||||||
import { URLs } from '../../../__data__/urls';
|
import { URLs } from '../../../__data__/urls';
|
||||||
|
|
||||||
export const CtaButton: FC<ButtonProps> = (props) => {
|
export const CtaButton: FC<ButtonProps> = (props) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation('~', { keyPrefix: 'dry-wash.landing' });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
@ -15,7 +15,7 @@ export const CtaButton: FC<ButtonProps> = (props) => {
|
|||||||
colorScheme='primary'
|
colorScheme='primary'
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{t('~:dry-wash.landing.make-order-button')}
|
{t('make-order-button')}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,22 +1,23 @@
|
|||||||
import React, { FC } from 'react';
|
import React, { FC } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Box, Heading, Text, Center, VStack, BoxProps } from '@chakra-ui/react';
|
import { Box, Heading, Text, Center, VStack } from '@chakra-ui/react';
|
||||||
|
|
||||||
import { DemoVideoPosterImg } from '../../../assets/images';
|
import { DemoVideoPosterImg } from '../../../assets/images';
|
||||||
import { CtaButton, SiteLogo, PageSection } from '../';
|
import { CtaButton, SiteLogo, PageSection } from '../';
|
||||||
|
|
||||||
type HeroSectionProps = Pick<BoxProps, 'flexShrink'>;
|
import { HeroSectionProps } from './types';
|
||||||
|
|
||||||
export const HeroSection: FC<HeroSectionProps> = ({ flexShrink }) => {
|
export const HeroSection: FC<HeroSectionProps> = ({
|
||||||
const { t } = useTranslation('~', {
|
data: { headline, description, video } = {},
|
||||||
keyPrefix: 'dry-wash.landing.hero-section',
|
flexShrink,
|
||||||
});
|
}) => {
|
||||||
|
const { t } = useTranslation('~', { keyPrefix: 'dry-wash.landing' });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box flexShrink={flexShrink} as='header' pos='relative' zIndex={0}>
|
<Box flexShrink={flexShrink} as='header' pos='relative' zIndex={0}>
|
||||||
<Box
|
<Box
|
||||||
as='video'
|
as='video'
|
||||||
src={`${__webpack_public_path__}/remote-assets/demo.mp4`}
|
src={`${__webpack_public_path__}/remote-assets/${video}`}
|
||||||
poster={DemoVideoPosterImg}
|
poster={DemoVideoPosterImg}
|
||||||
autoPlay
|
autoPlay
|
||||||
loop
|
loop
|
||||||
@ -47,14 +48,14 @@ export const HeroSection: FC<HeroSectionProps> = ({ flexShrink }) => {
|
|||||||
color='white'
|
color='white'
|
||||||
__css={{ textWrap: 'balance' }}
|
__css={{ textWrap: 'balance' }}
|
||||||
>
|
>
|
||||||
{t('headline')}
|
{t(headline)}
|
||||||
</Heading>
|
</Heading>
|
||||||
<Text
|
<Text
|
||||||
textAlign='center'
|
textAlign='center'
|
||||||
__css={{ textWrap: 'balance' }}
|
__css={{ textWrap: 'balance' }}
|
||||||
color='white'
|
color='white'
|
||||||
>
|
>
|
||||||
{t('description')}
|
{t(description)}
|
||||||
</Text>
|
</Text>
|
||||||
</VStack>
|
</VStack>
|
||||||
<CtaButton size='lg' />
|
<CtaButton size='lg' />
|
||||||
|
9
src/components/landing/HeroSection/types.ts
Normal file
9
src/components/landing/HeroSection/types.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { BoxProps } from "@chakra-ui/react";
|
||||||
|
|
||||||
|
export type HeroSectionProps = {
|
||||||
|
data: {
|
||||||
|
headline: 'hero-section.headline';
|
||||||
|
description: 'hero-section.description';
|
||||||
|
video: string;
|
||||||
|
};
|
||||||
|
} & Pick<BoxProps, 'flexShrink'>;
|
@ -5,15 +5,16 @@ import { Heading, HStack } from '@chakra-ui/react';
|
|||||||
import { CtaButton, PageSection } from '../';
|
import { CtaButton, PageSection } from '../';
|
||||||
|
|
||||||
import { ReviewsSlider } from './ReviewsSlider';
|
import { ReviewsSlider } from './ReviewsSlider';
|
||||||
|
import { SocialProofSectionProps } from './types';
|
||||||
|
|
||||||
export const SocialProofSection: FC = () => {
|
export const SocialProofSection: FC<SocialProofSectionProps> = ({
|
||||||
const { t } = useTranslation('~', {
|
data: { heading } = {},
|
||||||
keyPrefix: 'dry-wash.landing.social-proof-section',
|
}) => {
|
||||||
});
|
const { t } = useTranslation('~', { keyPrefix: 'dry-wash.landing' });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageSection>
|
<PageSection>
|
||||||
<Heading as='h2'>{t('heading')}</Heading>
|
<Heading as='h2'>{t(heading)}</Heading>
|
||||||
<ReviewsSlider />
|
<ReviewsSlider />
|
||||||
<HStack w='full' justify='flex-end'>
|
<HStack w='full' justify='flex-end'>
|
||||||
<CtaButton />
|
<CtaButton />
|
||||||
|
@ -1 +1,2 @@
|
|||||||
|
export type { SocialProofSectionProps } from './types';
|
||||||
export { SocialProofSection } from './SocialProofSection';
|
export { SocialProofSection } from './SocialProofSection';
|
5
src/components/landing/SocialProofSection/types.ts
Normal file
5
src/components/landing/SocialProofSection/types.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export type SocialProofSectionProps = {
|
||||||
|
data: {
|
||||||
|
heading: 'social-proof-section.heading';
|
||||||
|
};
|
||||||
|
};
|
1
src/lib/index.ts
Normal file
1
src/lib/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './types';
|
41
src/lib/types.ts
Normal file
41
src/lib/types.ts
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* @example type Output = ArrElement<['a', 'b', 'c']>;
|
||||||
|
* // "a" | "b" | "c"
|
||||||
|
*/
|
||||||
|
export type ArrElement<ArrType> = ArrType extends readonly (infer ElementType)[]
|
||||||
|
? ElementType
|
||||||
|
: never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @example type Output = Split<'a.b1' | 'a.b2', '.'>;
|
||||||
|
* // ["a", "b1"] | ["a", "b2"]
|
||||||
|
*/
|
||||||
|
type Split<S extends string, D extends string> =
|
||||||
|
S extends `${infer A}${D}${infer B}` ? [A, ...Split<B, D>] : [S];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @example type Output = NestedObject<["a", "b1"] | ["a", "b2"]>;
|
||||||
|
* // { a: { b1: string; }; } | { a: { b2: string; }; }
|
||||||
|
*/
|
||||||
|
type NestedObject<T extends string[]> =
|
||||||
|
T extends [infer Head, ...infer Tail] ?
|
||||||
|
Head extends string ?
|
||||||
|
{ [key in Head]: NestedObject<Tail extends string[] ? Tail : []> } : never :
|
||||||
|
string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @example type Output = UnionToIntersection<{ a: { b1: string; }; } | { a: { b2: string; }; }>;
|
||||||
|
* // { a: { b1: string; }; } & { a: { b2: string; }; }
|
||||||
|
*/
|
||||||
|
type UnionToIntersection<U> =
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
(U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @example type Output = CreateTree<'a.b1' | 'a.b2', '.'>;
|
||||||
|
* // { a: { b1: string; }; } & { a: { b2: string; }; }
|
||||||
|
*/
|
||||||
|
export type CreateTree<T> =
|
||||||
|
UnionToIntersection<T extends infer U ?
|
||||||
|
U extends string ?
|
||||||
|
NestedObject<Split<U, '.'>> : never : never>;
|
23
src/models/i18next.d.ts
vendored
23
src/models/i18next.d.ts
vendored
@ -1,24 +1,5 @@
|
|||||||
import defaultLocale from '../../locales/ru.json';
|
import defaultLocale from '../../locales/ru.json';
|
||||||
|
import { CreateTree } from '../lib';
|
||||||
type Split<S extends string, D extends string> =
|
|
||||||
S extends `${infer A}${D}${infer B}` ? [A, ...Split<B, D>] : [S];
|
|
||||||
|
|
||||||
type NestedObject<T extends string[]> =
|
|
||||||
T extends [infer Head, ...infer Tail] ?
|
|
||||||
Head extends string ?
|
|
||||||
{ [key in Head]: NestedObject<Tail extends string[] ? Tail : []> } : never :
|
|
||||||
string;
|
|
||||||
|
|
||||||
// Основная утилита для обработки union type
|
|
||||||
type CreateTree<T> =
|
|
||||||
UnionToIntersection<T extends infer U ?
|
|
||||||
U extends string ?
|
|
||||||
NestedObject<Split<U, '.'>> : never : never>;
|
|
||||||
|
|
||||||
// Утилита для объединения типов
|
|
||||||
type UnionToIntersection<U> =
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
(U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
||||||
|
|
||||||
type LanguageResource = CreateTree<keyof typeof defaultLocale>;
|
type LanguageResource = CreateTree<keyof typeof defaultLocale>;
|
||||||
|
|
||||||
@ -26,6 +7,6 @@ declare module "i18next" {
|
|||||||
interface CustomTypeOptions {
|
interface CustomTypeOptions {
|
||||||
resources: {
|
resources: {
|
||||||
'~': LanguageResource
|
'~': LanguageResource
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
1
src/models/landing/index.ts
Normal file
1
src/models/landing/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './stubs';
|
1
src/models/landing/stubs/index.ts
Normal file
1
src/models/landing/stubs/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { default as LandingSuccessStub } from './success';
|
27
src/models/landing/stubs/success.ts
Normal file
27
src/models/landing/stubs/success.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Generated by json-literal-typer
|
||||||
|
// <-- BEGIN
|
||||||
|
interface HeroXsection {
|
||||||
|
description: "hero-section.description";
|
||||||
|
headline: "hero-section.headline";
|
||||||
|
video: "demo.mp4";
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Sections {
|
||||||
|
description?: "benefits-section.description";
|
||||||
|
heading: "benefits-section.heading" | "social-proof-section.heading";
|
||||||
|
list?: ("benefits-section.list.0" | "benefits-section.list.1" | "benefits-section.list.2" | "benefits-section.list.3")[];
|
||||||
|
type: "benefits-section" | "social-proof-section";
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Body {
|
||||||
|
"hero-section": HeroXsection;
|
||||||
|
sections: Sections[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Root {
|
||||||
|
body: Body;
|
||||||
|
success: true;
|
||||||
|
}
|
||||||
|
// END -->
|
||||||
|
|
||||||
|
export default Root;
|
@ -8,6 +8,12 @@ import {
|
|||||||
SocialProofSection,
|
SocialProofSection,
|
||||||
} from '../../components/landing';
|
} from '../../components/landing';
|
||||||
import { LandingThemeProvider } from '../../containers';
|
import { LandingThemeProvider } from '../../containers';
|
||||||
|
import { LandingSuccessStub } from '../../models/landing';
|
||||||
|
import landingSuccessStubJson from '../../../stubs/json/landing/success.json';
|
||||||
|
|
||||||
|
import { isBenefitsSectionData, isSocialProofSectionData } from './types';
|
||||||
|
|
||||||
|
const landingSuccessStub = landingSuccessStubJson as LandingSuccessStub;
|
||||||
|
|
||||||
const Page: FC = () => {
|
const Page: FC = () => {
|
||||||
return (
|
return (
|
||||||
@ -21,10 +27,19 @@ const Page: FC = () => {
|
|||||||
centerContent
|
centerContent
|
||||||
>
|
>
|
||||||
<VStack w='full' h='full' alignItems='stretch' flexGrow={1}>
|
<VStack w='full' h='full' alignItems='stretch' flexGrow={1}>
|
||||||
<HeroSection flexShrink={0} />
|
<HeroSection
|
||||||
|
data={landingSuccessStub['body']['hero-section']}
|
||||||
|
flexShrink={0}
|
||||||
|
/>
|
||||||
<VStack as='main' flexGrow={1}>
|
<VStack as='main' flexGrow={1}>
|
||||||
<BenefitsSection />
|
{landingSuccessStub.body.sections.map(({ type, ...data }, i) => {
|
||||||
<SocialProofSection />
|
if (isBenefitsSectionData(type, data)) {
|
||||||
|
return <BenefitsSection key={i} data={data} />;
|
||||||
|
}
|
||||||
|
if (isSocialProofSectionData(type, data)) {
|
||||||
|
return <SocialProofSection key={i} data={data} />;
|
||||||
|
}
|
||||||
|
})}
|
||||||
</VStack>
|
</VStack>
|
||||||
<Footer />
|
<Footer />
|
||||||
</VStack>
|
</VStack>
|
||||||
|
15
src/pages/landing/types.ts
Normal file
15
src/pages/landing/types.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import LandingSuccess from "../../../stubs/json/landing/success.json";
|
||||||
|
import { BenefitsSectionProps, SocialProofSectionProps } from "../../components/landing";
|
||||||
|
import { ArrElement } from "../../lib";
|
||||||
|
|
||||||
|
type SectionsItemData = ArrElement<typeof LandingSuccess['body']['sections']>;
|
||||||
|
type SectionType = SectionsItemData['type'];
|
||||||
|
type SectionData = Omit<SectionsItemData, 'type'>;
|
||||||
|
|
||||||
|
export const isBenefitsSectionData = (type: SectionType, data: SectionData): data is BenefitsSectionProps['data'] => {
|
||||||
|
return type === 'benefits-section';
|
||||||
|
};
|
||||||
|
|
||||||
|
export const isSocialProofSectionData = (type: SectionType, data: SectionData): data is SocialProofSectionProps['data'] => {
|
||||||
|
return type === 'social-proof-section';
|
||||||
|
};
|
27
stubs/json/landing/success.json
Normal file
27
stubs/json/landing/success.json
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"body": {
|
||||||
|
"hero-section": {
|
||||||
|
"headline": "hero-section.headline",
|
||||||
|
"description": "hero-section.description",
|
||||||
|
"video": "demo.mp4"
|
||||||
|
},
|
||||||
|
"sections": [
|
||||||
|
{
|
||||||
|
"type": "benefits-section",
|
||||||
|
"heading": "benefits-section.heading",
|
||||||
|
"description": "benefits-section.description",
|
||||||
|
"list": [
|
||||||
|
"benefits-section.list.0",
|
||||||
|
"benefits-section.list.1",
|
||||||
|
"benefits-section.list.2",
|
||||||
|
"benefits-section.list.3"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "social-proof-section",
|
||||||
|
"heading": "social-proof-section.heading"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user