webapp/src/components/Discours/Footer.tsx

123 lines
4.0 KiB
TypeScript
Raw Normal View History

import { clsx } from 'clsx'
2024-06-25 22:52:46 +00:00
import { For, createSignal, onMount } from 'solid-js'
import { useLocalize } from '~/context/localize'
2022-11-14 17:41:05 +00:00
import { Icon } from '../_shared/Icon'
import { Newsletter } from '../_shared/Newsletter'
import styles from './Footer.module.scss'
2022-09-09 11:53:35 +00:00
2024-06-25 22:52:46 +00:00
const social = [
{ name: 'facebook', href: 'https://facebook.com/discoursio' },
{ name: 'vk', href: 'https://vk.com/discoursio' },
{ name: 'twitter', href: 'https://twitter.com/discours_io' },
2024-06-26 08:22:05 +00:00
{ name: 'telegram', href: 'https://t.me/discoursio' }
2024-06-25 22:52:46 +00:00
]
type FooterItem = {
title: string
slug: string
rel?: string
}
export const FooterView = () => {
const { t, lang } = useLocalize()
2024-06-26 08:22:05 +00:00
const [footerLinks, setFooterLinks] = createSignal<Array<{ header: string; items: FooterItem[] }>>([])
2022-09-09 11:53:35 +00:00
2024-06-25 22:52:46 +00:00
onMount(() => {
setFooterLinks([
{
header: t('About the project'),
items: [
2024-07-05 07:23:59 +00:00
{ title: t('Discours Manifest'), slug: '/manifest' },
2024-07-03 21:25:03 +00:00
{ title: t('How it works'), slug: '/guide' },
2024-07-05 19:40:54 +00:00
{ title: t('Dogma'), slug: '/dogma' },
{ title: t('Our principles'), slug: '/principles' },
2024-06-26 08:22:05 +00:00
{ title: t('How to write an article'), slug: '/how-to-write-a-good-article' }
]
2024-06-25 22:52:46 +00:00
},
{
header: t('Participating'),
items: [
{ title: t('Suggest an idea'), slug: '/connect' },
2024-07-03 21:25:03 +00:00
{ title: t('Become an author'), slug: '/edit/new' },
2024-07-05 07:23:59 +00:00
{ title: t('Support Discours'), slug: '/support' },
2024-06-26 08:22:05 +00:00
{
2024-07-05 07:38:53 +00:00
title: t('Cooperate with Discours'),
2024-06-26 08:22:05 +00:00
slug: 'https://docs.google.com/forms/d/e/1FAIpQLSeNNvIzKlXElJtkPkYiXl-jQjlvsL9u4-kpnoRjz1O8Wo40xQ/viewform'
}
]
2024-06-25 22:52:46 +00:00
},
{
header: t('Sections'),
items: [
2024-07-03 21:25:03 +00:00
{ title: t('Authors'), slug: '/author' },
2024-06-25 22:52:46 +00:00
{ title: t('Communities'), slug: '/community' },
2024-07-05 07:23:59 +00:00
{ title: t('Partners'), slug: '/partners' },
2024-07-05 19:40:54 +00:00
{ title: t('Special projects'), slug: '/projects' },
2024-06-26 08:22:05 +00:00
{
title: lang() === 'ru' ? 'English' : 'Русский',
slug: `?lng=${lang() === 'ru' ? 'en' : 'ru'}`,
rel: 'external'
}
]
}
2024-06-25 22:52:46 +00:00
])
})
2022-09-09 11:53:35 +00:00
return (
2022-10-19 22:16:17 +00:00
<footer class={styles.discoursFooter}>
2022-11-20 21:23:12 +00:00
<div class="wide-container">
2022-09-09 11:53:35 +00:00
<div class="row">
2024-06-25 22:52:46 +00:00
<For each={footerLinks()}>
2022-09-09 11:53:35 +00:00
{({ header, items }) => (
2023-03-10 17:42:48 +00:00
<div class="col-sm-8 col-md-6">
2024-06-25 22:52:46 +00:00
<h5>{t(header)}</h5>
2022-09-09 11:53:35 +00:00
<ul>
<For each={items}>
2024-06-25 22:52:46 +00:00
{({ slug, title, rel }: FooterItem) => (
2022-09-09 11:53:35 +00:00
<li>
{' '}
2024-06-25 22:52:46 +00:00
<a href={slug} rel={rel}>
{rel ? title : t(title)}
2023-02-17 09:21:02 +00:00
</a>{' '}
2022-09-09 11:53:35 +00:00
</li>
)}
</For>
</ul>
</div>
)}
</For>
2023-03-10 17:42:48 +00:00
<div class="col-md-6">
2022-09-09 11:53:35 +00:00
<h5>{t('Subscription')}</h5>
<p>{t('Join our maillist')}</p>
<Newsletter />
2022-09-09 11:53:35 +00:00
</div>
</div>
2022-10-19 22:16:17 +00:00
<div class={clsx(styles.footerCopyright, 'row')}>
2023-03-10 17:42:48 +00:00
<div class="col-md-18 col-lg-20">
2023-02-17 09:21:02 +00:00
{t(
2024-06-26 08:22:05 +00:00
'Independant magazine with an open horizontal cooperation about culture, science and society'
2023-02-17 09:21:02 +00:00
)}
. {t('Discours')} &copy; 2015&ndash;{new Date().getFullYear()}{' '}
2024-07-05 07:23:59 +00:00
<a href="/terms">{t('Terms of use')}</a>
2022-09-09 11:53:35 +00:00
</div>
2023-03-10 17:42:48 +00:00
<div class={clsx(styles.footerCopyrightSocial, 'col-md-6 col-lg-4')}>
2024-02-05 15:04:23 +00:00
<For each={social}>
2024-06-25 22:52:46 +00:00
{(provider) => (
2024-06-26 08:22:05 +00:00
<div
class={clsx(
styles.socialItem,
styles[`socialItem${provider.name}` as keyof typeof styles]
)}
>
2024-06-25 22:52:46 +00:00
<a href={provider.href}>
<Icon name={`${provider.name}-white`} class={styles.icon} />
</a>
</div>
)}
2022-09-09 11:53:35 +00:00
</For>
</div>
</div>
</div>
</footer>
)
}