Skip to content

Commit 86fa918

Browse files
committed
Add Social links to Footer
1 parent 031a42e commit 86fa918

File tree

6 files changed

+94
-8
lines changed

6 files changed

+94
-8
lines changed

src/app/components/PageLayout/Footer.tsx

Lines changed: 64 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,43 @@ import { ReopenAnalyticsConsentButton } from 'app/components/AnalyticsConsent'
99
import { Typography } from '@oasisprotocol/ui-library/src/components/typography'
1010
import { Link } from '@oasisprotocol/ui-library/src/components/link'
1111
import { cn } from '@oasisprotocol/ui-library/src/lib/utils'
12+
import { socialMedia } from '../../utils/externalLinks'
13+
import telegram from '../Social/images/telegram_black.svg'
14+
import twitter from '../Social/images/twitter_black.svg'
15+
import discord from '../Social/images/discord_black.svg'
16+
import youtube from '../Social/images/youtube_black.svg'
17+
import reddit from '../Social/images/reddit_black.svg'
1218

1319
interface FooterProps {
1420
scope?: SearchScope
1521
mobileSearchAction?: ReactNode
1622
enableMobileSearch?: boolean
1723
}
1824

25+
type SocialLinkProps = {
26+
label: string
27+
href: string
28+
imgSrc?: string
29+
img?: ReactNode
30+
}
31+
32+
const SocialLinkFooter: FC<SocialLinkProps> = ({ label, href, imgSrc }) => {
33+
return (
34+
<Link href={href} rel="noopener noreferrer" target="_blank">
35+
{imgSrc && <img src={imgSrc} alt={label} className="h-5 inline-block" />}
36+
</Link>
37+
)
38+
}
39+
1940
export const Footer: FC<FooterProps> = ({ scope, mobileSearchAction, enableMobileSearch = true }) => {
2041
const { t } = useTranslation()
2142
const { isMobile, isTablet } = useScreenSize()
2243
const currentYear = useConstant(() => new Date().getFullYear())
2344
const hasMobileAction = isMobile && mobileSearchAction
2445

2546
return (
26-
<footer>
27-
<div
28-
className={cn('flex justify-between items-center py-6 sm:px-6', enableMobileSearch ? 'px-2' : 'px-4')}
29-
>
47+
<footer className="flex flex-col py-4 md:pb-4 md:pt-6">
48+
<div className={cn('flex justify-between items-center sm:px-0', enableMobileSearch ? 'px-2' : 'px-4')}>
3049
{isTablet ? (
3150
<AppendMobileSearch
3251
scope={scope}
@@ -44,7 +63,7 @@ export const Footer: FC<FooterProps> = ({ scope, mobileSearchAction, enableMobil
4463
</AppendMobileSearch>
4564
) : (
4665
<>
47-
<div className="flex items-center">
66+
<div className="flex flex-1 flex-wrap items-center">
4867
{import.meta.env.REACT_APP_BUILD_SHA && (
4968
<Typography variant="xsmall" textColor="muted">
5069
<Trans
@@ -107,9 +126,46 @@ export const Footer: FC<FooterProps> = ({ scope, mobileSearchAction, enableMobil
107126
</Typography>
108127
</div>
109128
</div>
110-
<Typography variant="xsmall" textColor="muted">
111-
{t('footer.title')} | <ReopenAnalyticsConsentButton /> | {currentYear}
112-
</Typography>
129+
<div className="flex items-center gap-6 ">
130+
<Typography variant="xsmall" textColor="muted">
131+
{t('footer.title')} | <ReopenAnalyticsConsentButton /> | {currentYear}
132+
</Typography>
133+
<div>
134+
<div className="h-5 flex items-center gap-4 justify-between">
135+
{socialMedia.telegram && (
136+
<SocialLinkFooter
137+
label={t('social.telegram')}
138+
href={socialMedia.telegram}
139+
imgSrc={telegram}
140+
/>
141+
)}
142+
{socialMedia.twitter && (
143+
<SocialLinkFooter
144+
label={t('social.twitter')}
145+
href={socialMedia.twitter}
146+
imgSrc={twitter}
147+
/>
148+
)}
149+
{socialMedia.discord && (
150+
<SocialLinkFooter
151+
label={t('social.discord')}
152+
href={socialMedia.discord}
153+
imgSrc={discord}
154+
/>
155+
)}
156+
{socialMedia.youtube && (
157+
<SocialLinkFooter
158+
label={t('social.youtube')}
159+
href={socialMedia.youtube}
160+
imgSrc={youtube}
161+
/>
162+
)}
163+
{socialMedia.reddit && (
164+
<SocialLinkFooter label={t('social.reddit')} href={socialMedia.reddit} imgSrc={reddit} />
165+
)}
166+
</div>
167+
</div>
168+
</div>
113169
</>
114170
)}
115171
</div>
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 8 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 7 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)