omnivore/packages/web/components/elements/MobileInstallHelp.tsx

288 lines
7.9 KiB
TypeScript
Raw Normal View History

2022-03-28 12:57:28 +00:00
import React from 'react'
import {
Desktop,
DeviceTabletSpeaker,
DeviceMobileCamera,
} from 'phosphor-react'
import { Box, HStack } from '../elements/LayoutPrimitives'
2023-02-27 02:34:12 +00:00
import { StyledText, StyledAnchor } from '../elements/StyledText'
import { TooltipWrapped } from './Tooltip'
2022-03-28 12:57:28 +00:00
import Link from 'next/link'
const TooltipStyle = {
backgroundColor: '#F9D354',
color: '#0A0806',
}
2022-02-11 17:24:33 +00:00
2022-05-03 17:24:47 +00:00
type MobileInstallHelpProps = {
onboarding?: boolean
}
export default function MobileInstallHelp({
onboarding = false,
}: MobileInstallHelpProps): JSX.Element {
2022-03-28 12:57:28 +00:00
const [selectedTooltip, setSelectedTooltip] =
React.useState<string>('Available for Mac')
const platformSizes = [
{
label: 'Available for Mac',
icon: <Desktop color="#F9D354" />,
},
{
label: 'Available for iPad',
icon: <DeviceTabletSpeaker color="#F9D354" />,
},
{
label: 'Available for iPhone',
icon: <DeviceMobileCamera color="#F9D354" />,
},
]
2022-05-03 17:24:47 +00:00
2022-12-21 08:52:55 +00:00
const iosContainerStyles = {
marginTop: '12px',
width: '100%',
height: '40px',
display: 'flex',
justifyContent: !onboarding ? 'flex-end' : 'initial',
}
2022-05-03 17:24:47 +00:00
2022-02-11 17:24:33 +00:00
return (
<Box
2022-02-11 17:24:33 +00:00
css={{
display: 'grid',
gridTemplateColumns: '1fr 2fr',
2022-05-03 17:24:47 +00:00
gridTemplateRows: !onboarding ? '.5fr .5fr .5fr' : '.5fr',
backgroundColor: '$grayBg',
padding: '15px',
2022-03-28 12:57:28 +00:00
'@lg': {
marginTop: '0',
paddingTop: '0',
gridTemplateColumns: '1fr 2fr 1fr',
gridTemplateRows: '1fr',
height: '9rem',
},
2022-02-11 17:24:33 +00:00
}}
>
2022-03-28 12:57:28 +00:00
<Box
css={{
gridColumn: 1 / 2,
gridRow: 1 / 2,
marginRight: '$3',
2022-03-28 12:57:28 +00:00
minWidth: '170px',
maxWidth: '200px',
alignSelf: 'center',
'@lg': {
minWidth: '200px',
gridColumn: '1',
gridRow: '1',
},
2022-03-28 12:57:28 +00:00
backgroundColor: '$grayBase',
display: 'flex',
position: 'relative',
height: '116px',
}}
2022-03-28 12:57:28 +00:00
>
<Box
css={{
position: 'absolute',
top: '-15px',
}}
>
2022-05-03 17:24:47 +00:00
<img
srcSet="/static/images/mobile-app-preview.png,
/static/images/mobile-app-preview@2x.png 2x"
/>
2022-03-28 12:57:28 +00:00
</Box>
</Box>
<Box
css={{
gridColumn: '2',
gridRow: '1',
2022-03-28 12:57:28 +00:00
display: 'flex',
flexDirection: 'column',
'@lg': {
2022-12-21 08:52:55 +00:00
marginTop: '16px',
},
}}
>
<StyledText
as={'h3'}
css={{
fontSize: '18px',
fontWeight: 700,
marginTop: 0,
marginBottom: 0,
2022-05-03 17:24:47 +00:00
color: !onboarding ? '$grayTextContrast' : 'rgba(10, 8, 6, 0.8)',
lineHeight: '22.5px',
2022-03-28 12:57:28 +00:00
'@lg': {
fontSize: '16px',
lineHeight: '20px',
},
}}
>
Install Omnivore for iOS
</StyledText>
</Box>
<StyledText
css={{
size: '14px',
my: '$2',
fontWeight: 400,
2022-05-03 17:24:47 +00:00
color: !onboarding ? '$grayTextContrast' : 'rgba(10, 8, 6, 0.8)',
maxWidth: '20rem',
lineHeight: '21px',
gridColumn: '1 / span 3',
gridRow: '2 / 3',
alignSelf: 'center',
2022-05-03 17:24:47 +00:00
'@lgDown': {
display: !onboarding ? 'initial' : 'none',
},
2022-03-28 12:57:28 +00:00
'@lg': {
gridColumn: '2',
gridRow: '1',
alignSelf: 'center',
2022-05-03 17:24:47 +00:00
marginTop: !onboarding ? '$4' : 65,
},
}}
>
With the Omnivore iOS app installed you can save any link using our
share extension.
<br />
2022-05-03 17:24:47 +00:00
{!onboarding && (
<Link passHref href="/help/saving-links">
<StyledAnchor
css={{
color: '$grayTextContrast',
fontSize: '14px',
fontWeight: 600,
2022-05-16 23:27:37 +00:00
textDecoration: 'underline',
2022-05-03 17:24:47 +00:00
}}
>
Learn more about the iOS app -&gt;
2022-05-03 17:24:47 +00:00
</StyledAnchor>
</Link>
)}
2022-02-11 17:24:33 +00:00
</StyledText>
<HStack
2022-05-03 17:24:47 +00:00
alignment="center"
css={{
gridRow: '3',
display: 'flex',
alignItems: 'center',
gridColumn: '1 / span 2',
flexDirection: !onboarding ? 'row-reverse' : 'inherit',
2022-05-03 17:24:47 +00:00
justifyContent: !onboarding ? 'space-between' : 'center',
mt: !onboarding ? 'inherit' : 10,
2022-03-28 12:57:28 +00:00
'@lg': {
2022-05-03 17:24:47 +00:00
flexDirection: !onboarding ? 'row-reverse' : 'column-reverse',
alignItems: !onboarding ? 'center' : 'flex-end',
gridColumn: '3',
gridRow: '1',
},
}}
>
2022-05-03 17:24:47 +00:00
<Box
css={
!onboarding
2022-12-21 08:52:55 +00:00
? { ...iosContainerStyles, '@lg': { pl: '16px' } }
2022-05-03 17:24:47 +00:00
: {
...iosContainerStyles,
pl: 16,
'@lg': {
marginTop: '24px',
justifyContent: 'flex-end',
},
}
}
>
<a
href="https://omnivore.app/install/ios"
target="_blank"
rel="noreferrer"
style={{ display: 'inlineBlock', overflow: 'hidden' }}
>
<img
src="https://tools.applemediaservices.com/api/badges/download-on-the-app-store/black/en-us?size=90x37&amp;releaseDate=1628121600&h=2bbc629b0455dbea136257c9f518e4b3"
alt="Download on the App Store"
style={{}}
/>
</a>
2022-03-28 21:49:19 +00:00
</Box>
<HStack
2022-05-03 17:24:47 +00:00
css={
!onboarding
? {
width: '40%',
justifyContent: 'space-between',
maxWidth: '13rem',
visibility: 'collapse',
'@lg': {
width: '100%',
visibility: 'unset',
},
}
: {
width: '40%',
justifyContent: 'space-between',
maxWidth: '13rem',
visibility: 'unset',
'@lg': {
width: '146px',
// maxWidth: '210px'
2022-12-21 08:52:55 +00:00
},
2022-05-03 17:24:47 +00:00
}
}
>
{platformSizes.map((item, idx) => (
<TooltipWrapped
key={`platformSize-${idx}`}
tooltipContent={item.label}
tooltipSide={'top'}
style={TooltipStyle}
arrowStyles={{ fill: '#F9D354' }}
>
<Box
css={{
ml: '$1',
}}
>
<StyledAnchor
onClick={() => setSelectedTooltip(item.label)}
css={{
mx: 'auto',
borderRadius: '50%',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
height: 35,
width: 35,
cursor: 'pointer',
2023-03-09 05:18:44 +00:00
backgroundColor: '$labelButtonsBg',
...(selectedTooltip !== item.label && {
filter: 'grayscale(1)',
}),
'&:focus': {
filter: 'grayscale(0)',
},
'&:active': {
filter: 'grayscale(0)',
},
'@lg': {
transition: 'filter .3s linear',
'&:hover': {
2022-03-28 12:57:28 +00:00
filter: 'grayscale(0)',
},
},
}}
>
{item.icon}
</StyledAnchor>
</Box>
</TooltipWrapped>
))}
</HStack>
</HStack>
</Box>
2022-02-11 17:24:33 +00:00
)
}