Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Feat: add AppStore button in the footer
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Mar 22, 2022
1 parent e897403 commit b20a674
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 18 deletions.
46 changes: 46 additions & 0 deletions src/assets/icons/appstore-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/appstore-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/components/AppLayout/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { makeStyles } from '@material-ui/core/styles'
import cn from 'classnames'
import * as React from 'react'
import { useDispatch } from 'react-redux'
import AppstoreButton from 'src/components/AppstoreButton'

import GnoButtonLink from 'src/components/layout/ButtonLink'
import Link from 'src/components/layout/Link'
Expand All @@ -16,6 +17,7 @@ const useStyles = makeStyles({
flexShrink: '1',
flexWrap: 'wrap',
justifyContent: 'center',
alignItems: 'center',
margin: '0 auto',
maxWidth: '100%',
padding: `20px ${sm} 20px`,
Expand Down Expand Up @@ -87,6 +89,8 @@ const Footer = (): React.ReactElement => {
>
{appVersion}
</Link>
<span className={classes.sep}>|</span>
<AppstoreButton light placement="footer" />
</footer>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ const styles = () => ({
justifyCenter: {
justifyContent: 'center',
},
appStore: {
height: '35px',
},
})

const StyledCard = styled(Card)`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Row from 'src/components/layout/Row'
import usePairing from 'src/logic/wallets/pairing/hooks/usePairing'
import { initPairing, isPairingModule } from 'src/logic/wallets/pairing/utils'
import { useGetPairingUri } from 'src/logic/wallets/pairing/hooks/useGetPairingUri'
import AppstoreButton from 'src/components/AppstoreButton'

const StyledDivider = styled(Divider)`
width: calc(100% + 40px);
Expand Down Expand Up @@ -63,13 +64,7 @@ const PairingDetails = ({ classes }: { classes: Record<string, string> }): React
</Row>

<Row className={classes.justifyCenter}>
<a href="https://apps.apple.com/us/app/gnosis-safe/id1515759131">
<img
src="https://tools.applemediaservices.com/api/badges/download-on-the-app-store/black/en-us?size=250x83&amp;releaseDate=1599436800&h=93244e063e3bdf5b5b9f93aff647da09"
alt="Download on the App Store"
className={classes.appStore}
/>
</a>
<AppstoreButton placement="pairing" />
</Row>
</>
)
Expand Down
9 changes: 1 addition & 8 deletions src/components/AppLayout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { useState } from 'react'
import styled from 'styled-components'
import { useLocation, matchPath } from 'react-router-dom'

import { ListItemType } from 'src/components/List'

import Header from './Header'
import Footer from './Footer'
import Sidebar from './Sidebar'
import { MobileNotSupported } from './MobileNotSupported'
import { SAFE_ROUTES, WELCOME_ROUTE } from 'src/routes/routes'
import useDarkMode from 'src/logic/hooks/useDarkMode'

const Container = styled.div`
Expand Down Expand Up @@ -93,15 +91,10 @@ const Layout: React.FC<Props> = ({
sidebarItems,
}): React.ReactElement => {
const [mobileNotSupportedClosed, setMobileNotSupportedClosed] = useState(false)
const { pathname } = useLocation()
useDarkMode()

const closeMobileNotSupported = () => setMobileNotSupportedClosed(true)

const hasFooter = !!matchPath(pathname, {
path: [SAFE_ROUTES.SETTINGS, WELCOME_ROUTE],
})

return (
<Container>
<HeaderWrapper>
Expand All @@ -122,7 +115,7 @@ const Layout: React.FC<Props> = ({
</SidebarWrapper>
<ContentWrapper>
<div>{children}</div>
{hasFooter && <Footer />}
<Footer />
</ContentWrapper>
</BodyWrapper>

Expand Down
30 changes: 30 additions & 0 deletions src/components/AppstoreButton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { ReactElement } from 'react'
import AppstoreLightBadge from 'src/assets/icons/appstore-light.png'
import AppstoreDarkBadge from 'src/assets/icons/appstore-dark.svg'

enum LINKS {
footer = 'https://apps.apple.com/app/apple-store/id1515759131?pt=119497694&ct=Web%20App%20Footer&mt=8',
pairing = 'https://apps.apple.com/us/app/gnosis-safe/id1515759131',
}

type AppstoreButtonProps = {
light?: boolean
placement: 'footer' | 'pairing'
}

const AppstoreButton = (props: AppstoreButtonProps): ReactElement => {
return (
<a href={LINKS[props.placement]} target="_blank" rel="noreferrer">
<img
src={props.light ? AppstoreLightBadge : AppstoreDarkBadge}
alt="Download on the App Store"
style={{
display: 'block',
height: `${props.light ? 30 : 35}px`,
}}
/>
</a>
)
}

export default AppstoreButton

0 comments on commit b20a674

Please sign in to comment.