Skip to content
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
Binary file not shown.
Binary file not shown.
Binary file removed public/keepsimple_/assets/longevity/dna-white-bg.mp4
Binary file not shown.
Binary file removed public/keepsimple_/assets/longevity/dna.mp4
Binary file not shown.
Binary file added public/keepsimple_/assets/longevity/dna/blue.mp4
Binary file not shown.
Binary file not shown.
Binary file added public/keepsimple_/assets/longevity/dna/red.mp4
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions src/assets/icons/longevity/Borders.tsx

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions src/assets/icons/longevity/LearnMoreIcon.tsx

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions src/assets/icons/longevity/Study/CloseIcon.tsx

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions src/components/longevity/BorderedPill/BorderedPill.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.root {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
background-color: #ffffff66;

width: 100%;
max-width: 320px;
min-height: 42px;
padding: 9px 28px;
border: 0;
cursor: pointer;

.border {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 0;
}

.content {
position: relative;
z-index: 1;
display: flex;
gap: 12px;
font-size: 16px;

svg {
padding-top: 3px;
}

.label {
padding-top: 2px;
}
}
}

.white {
color: #fff;

svg {
path {
fill: #fff;
}
}
}
35 changes: 35 additions & 0 deletions src/components/longevity/BorderedPill/BorderedPill.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React, { ElementType } from 'react';
import cn from 'classnames';

import type { BorderedPillProps } from './BorderedPill.types';

import Borders from '@icons/longevity/Borders';

import styles from './BorderedPill.module.scss';

export function BorderedPill<T extends ElementType = 'button'>({
as,
text,
leftIcon,
children,
className,
isWhite,
...rest
}: BorderedPillProps<T>) {
const Component = (as ?? 'button') as ElementType;

return (
<Component
className={cn(styles.root, className, {
[styles.white]: isWhite,
})}
{...(rest as any)}
>
<Borders className={styles.border} aria-hidden />
<span className={styles.content}>
{leftIcon ? <span className={styles.leftIcon}>{leftIcon}</span> : null}
{text ? <span className={styles.label}>{text} </span> : children}
</span>
</Component>
);
}
25 changes: 25 additions & 0 deletions src/components/longevity/BorderedPill/BorderedPill.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { ElementType, ReactNode } from 'react';

type CommonProps<T extends ElementType> = {
as?: T;
text?: string;
leftIcon?: ReactNode;
className?: string;
isWhite?: boolean;
children?: ReactNode;
};

type ButtonOnlyProps = {
onClick?: React.ButtonHTMLAttributes<HTMLButtonElement>['onClick'];
type?: 'button' | 'submit' | 'reset';
disabled?: boolean;
};

type NonButtonProps = {
onClick?: never;
type?: never;
disabled?: never;
};

export type BorderedPillProps<T extends ElementType = 'button'> =
CommonProps<T> & (T extends 'button' ? ButtonOnlyProps : NonButtonProps);
3 changes: 3 additions & 0 deletions src/components/longevity/BorderedPill/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { BorderedPill } from './BorderedPill';

export default BorderedPill;
32 changes: 16 additions & 16 deletions src/components/longevity/DietResults/DietResults.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
opacity: 60%;
cursor: pointer;

&:hover {
opacity: 1;
}

&.active {
opacity: 1;

Expand All @@ -38,7 +42,7 @@
}

.selected {
font-size: 8px;
font-size: 12px;
color: #fff;
text-transform: uppercase;
max-width: 100px;
Expand Down Expand Up @@ -69,22 +73,18 @@
transform: translateY(0);
}

.defaultLabel {
font-size: 8px;
text-transform: uppercase;
left: 0;
font-family: Aboreto-Regular, sans-serif;
font-weight: 400;
background-repeat: no-repeat;
background-size: cover;
bottom: 5px;
.tooltip {
background-color: #f2e7d6;
color: #000000d9;
width: 127px;
position: absolute;
background-image: url('/keepsimple_/assets/longevity/diet/default-label-bg.png');
height: 11px;
text-align: center;
padding-top: 3px;
font-size: 14px;
margin-top: -40px;
z-index: 788;
padding: 2.5px 9px;
border-radius: unset;

div {
display: none;
}
}
}

Expand Down
32 changes: 27 additions & 5 deletions src/components/longevity/DietResults/DietResults.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { FC } from 'react';
import Image from 'next/image';
import cn from 'classnames';
import { Tooltip as ReactTooltip } from 'react-tooltip';

import { DietResultsProps } from './DietResults.types';

Expand All @@ -10,16 +11,30 @@ const DietResults: FC<DietResultsProps> = ({
id,
scaleLevels,
setSelectedHealthyOptionId,
whatToEatItemNamesAndIds,
setIsIconClicked,
}) => {
const getSelectedHealthOptionName = (id: number) => {
const selectedOption = whatToEatItemNamesAndIds.find(
(option: any) => option.id === id,
);
return selectedOption ? selectedOption.name : null;
};

return (
<div className={styles.results}>
{scaleLevels.map((level, index) => (
<div
onClick={() => setSelectedHealthyOptionId(level.id)}
onClick={() => {
setSelectedHealthyOptionId(level.id);
setIsIconClicked(false);
requestAnimationFrame(() => setIsIconClicked(true));
}}
key={level.id}
className={cn(styles.item, {
[styles.active]: id === level.id,
})}
data-tooltip-id={level.id.toString()}
>
<Image
className={cn(styles.img, {})}
Expand All @@ -34,11 +49,18 @@ const DietResults: FC<DietResultsProps> = ({
[styles.active]: id === level.id,
})}
>
selected state
Your Diet
</span>
{index === 0 && (
<span className={styles.defaultLabel}>Borderline “OK” Foods</span>
)}
<ReactTooltip
id={level.id.toString()}
place={'bottom'}
className={cn(styles.tooltip, {})}
opacity={1}
>
<span className={styles.defaultLabel}>
{getSelectedHealthOptionName(index + 1)}
</span>
</ReactTooltip>
</div>
))}
</div>
Expand Down
9 changes: 9 additions & 0 deletions src/components/longevity/DietResults/DietResults.types.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
export type DietResultsProps = {
id?: number;
setIsIconClicked?: (isClicked: boolean) => void;
whatToEatItemNamesAndIds: {
name: string;
id: number;
}[];
selectedHealthOption: {
name: string;
id: number;
};
setSelectedHealthyOptionId?: (id: number) => void;
scaleLevels?: {
id: number;
Expand Down
34 changes: 23 additions & 11 deletions src/components/longevity/FlipCard/FlipCard.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@
background-size: cover;
background-repeat: no-repeat;
max-width: 948px;
height: 531px;
height: 550px;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin-bottom: 30px;
padding: 10px;

.pageSwitcherFlip {
position: absolute;
bottom: 120px;
right: 5px;
left: 93%;
bottom: 20px;
z-index: 55;
cursor: pointer;
right: 12px;
}

.headline {
Expand Down Expand Up @@ -61,7 +58,7 @@
}

.diamond {
width: 13px;
width: 10px;
height: 10px;
background-color: #df382e;
transform: rotate(45deg);
Expand All @@ -76,14 +73,12 @@

.painText {
margin: 0 30px;
width: 604px;

p {
margin: 0;
}
}

.divider {
}
}

.hacksFlipCard {
Expand Down Expand Up @@ -128,8 +123,12 @@
height: auto;
padding: 0;

.pageSwitcherFlip {
display: none;
}

.diamond {
width: 19px;
width: 10px;
}

.headline {
Expand All @@ -144,9 +143,22 @@
font-size: 16px;
}

.painText,
.hacksFlipCard {
p {
width: 267px;
}
}

.painText {
margin: 0 10px;
width: unset;
}

.chartWrapper {
.chartTitle {
font-size: 14px;
padding: 16px 0 32px 0;
}

.chart {
Expand Down
3 changes: 2 additions & 1 deletion src/components/longevity/FlipCard/FlipCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const FlipCard: FC<FlipCardProps> = ({
isHacks,
setSwitchPage,
switchPage,
chartWidth,
}) => {
return (
<div
Expand Down Expand Up @@ -64,7 +65,7 @@ const FlipCard: FC<FlipCardProps> = ({
<Image
src={chart}
alt={chartTitle ?? 'chart'}
width={512}
width={chartWidth || 590}
height={455}
className={styles.chart}
unoptimized
Expand Down
1 change: 1 addition & 0 deletions src/components/longevity/FlipCard/FlipCard.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export type FlipCardProps = {
quoteAuthor?: string;
setSwitchPage?: (value: boolean) => void;
switchPage?: boolean;
chartWidth?: number;
};
Loading