Improve design and extract data

This commit is contained in:
prototypa
2023-01-21 20:20:36 -05:00
parent 9397fe65f9
commit 79283511d9

View File

@ -1,94 +1,65 @@
--- ---
import { Icon } from 'astro-icon'; import { Icon } from 'astro-icon';
import { getHomePermalink, getPermalink, getAsset } from '~/utils/permalinks'; import { SITE } from '~/config.mjs';
import { getHomePermalink } from '~/utils/permalinks';
const links = [ interface Link {
{ text?: string;
title: 'Product', href?: string;
items: [ ariaLabel?: string;
{ title: 'Features', href: '#' }, icon?: string;
{ title: 'Security', href: '#' }, }
{ title: 'Team', href: '#' },
{ title: 'Enterprise', href: '#' },
{ title: 'Customer stories', href: '#' },
{ title: 'Pricing', href: '#' },
{ title: 'Resources', href: '#' },
],
},
{
title: 'Platform',
items: [
{ title: 'Developer API', href: '#' },
{ title: 'Partners', href: '#' },
{ title: 'Atom', href: '#' },
{ title: 'Electron', href: '#' },
{ title: 'AstroWind Desktop', href: '#' },
],
},
{
title: 'Support',
items: [
{ title: 'Docs', href: '#' },
{ title: 'Community Forum', href: '#' },
{ title: 'Professional Services', href: '#' },
{ title: 'Skills', href: '#' },
{ title: 'Status', href: '#' },
],
},
{
title: 'Company',
items: [
{ title: 'About', href: '#' },
{ title: 'Blog', href: '#' },
{ title: 'Careers', href: '#' },
{ title: 'Press', href: '#' },
{ title: 'Inclusion', href: '#' },
{ title: 'Social Impact', href: '#' },
{ title: 'Shop', href: '#' },
],
},
];
const social = [ interface Links {
{ label: 'Twitter', icon: 'tabler:brand-twitter', href: '#' }, title?: string;
{ label: 'Instagram', icon: 'tabler:brand-instagram', href: '#' }, links: Array<Link>;
{ label: 'Facebook', icon: 'tabler:brand-facebook', href: '#' }, }
{ label: 'RSS', icon: 'tabler:rss', href: getAsset('/rss.xml') },
{ label: 'Github', icon: 'tabler:brand-github', href: 'https://github.com/onwidget/astrowind' }, export interface Props {
]; links: Array<Links>;
secondaryLinks: Array<Link>;
socialLinks: Array<Link>;
footNote?: string;
theme?: string;
}
const { socialLinks = [], secondaryLinks = [], links = [], footNote = '', theme = 'light' } = Astro.props;
--- ---
<footer class="border-t border-gray-200 dark:border-slate-800"> <footer class:list={[{ dark: theme === 'dark' }, 'relative border-t border-gray-200 dark:border-slate-800']}>
<div class="max-w-6xl mx-auto px-4 sm:px-6"> <div class="dark:bg-dark absolute inset-0 pointer-events-none" aria-hidden="true"></div>
<div class="relative max-w-screen-xl mx-auto px-4 sm:px-6 dark:text-slate-300">
<div class="grid grid-cols-12 gap-4 gap-y-8 sm:gap-8 py-8 md:py-12"> <div class="grid grid-cols-12 gap-4 gap-y-8 sm:gap-8 py-8 md:py-12">
<div class="col-span-12 lg:col-span-4"> <div class="col-span-12 lg:col-span-4">
<div class="mb-2"> <div class="mb-2">
<a class="inline-block font-bold text-xl" href={getHomePermalink()}>AstroWind</a> <a class="inline-block font-bold text-xl" href={getHomePermalink()}>{SITE?.name}</a>
</div> </div>
<div class="text-sm text-gray-600"> <div class="text-sm text-gray-600">
<a {
class="text-gray-600 hover:text-gray-700 dark:text-gray-400 hover:underline transition duration-150 ease-in-out" secondaryLinks.map(({ text, href }) => (
href={getPermalink('/terms')}>Terms</a <a
> · class="text-gray-600 hover:text-gray-700 dark:text-gray-400 hover:underline transition duration-150 ease-in-out mr-2"
<a href={href}
class="text-gray-600 hover:text-gray-700 dark:text-gray-400 hover:underline transition duration-150 ease-in-out" set:html={text}
href={getPermalink('/privacy')}>Privacy Policy</a />
> ))
}
</div> </div>
</div> </div>
{ {
links.map(({ title, items }) => ( links.map(({ title, links }) => (
<div class="col-span-6 md:col-span-3 lg:col-span-2"> <div class="col-span-6 md:col-span-3 lg:col-span-2">
<div class="text-gray-800 dark:text-gray-300 font-medium mb-2">{title}</div> <div class="text-gray-800 dark:text-gray-300 font-medium mb-2">{title}</div>
{items && Array.isArray(items) && items.length > 0 && ( {links && Array.isArray(links) && links.length > 0 && (
<ul class="text-sm"> <ul class="text-sm">
{items.map(({ title, href }) => ( {links.map(({ text, href, ariaLabel }) => (
<li class="mb-2"> <li class="mb-2">
<a <a
class="text-gray-600 hover:text-gray-700 hover:underline dark:text-gray-400 transition duration-150 ease-in-out" class="text-gray-600 hover:text-gray-700 hover:underline dark:text-gray-400 transition duration-150 ease-in-out"
href={href} href={href}
aria-label={ariaLabel}
> >
{title} <Fragment set:html={text} />
</a> </a>
</li> </li>
))} ))}
@ -99,29 +70,29 @@ const social = [
} }
</div> </div>
<div class="md:flex md:items-center md:justify-between py-6 md:py-8"> <div class="md:flex md:items-center md:justify-between py-6 md:py-8">
<ul class="flex mb-4 md:order-1 -ml-2 md:ml-4 md:mb-0"> {
{ socialLinks?.length ? (
social.map(({ label, href, icon }) => ( <ul class="flex mb-4 md:order-1 -ml-2 md:ml-4 md:mb-0">
<li> {socialLinks.map(({ ariaLabel, href, text, icon }) => (
<a <li>
class="text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-2.5 inline-flex items-center" <a
aria-label={label} class="text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-2.5 inline-flex items-center"
href={href} aria-label={ariaLabel}
> href={href}
<Icon name={icon} class="w-5 h-5" /> >
</a> {icon && <Icon name={icon} class="w-5 h-5" />}
</li> <Fragment set:html={text} />
)) </a>
} </li>
</ul> ))}
</ul>
) : (
''
)
}
<div class="text-sm text-gray-700 mr-4 dark:text-slate-400"> <div class="text-sm text-gray-700 mr-4 dark:text-slate-400">
<span <Fragment set:html={footNote} />
class="w-5 h-5 md:w-6 md:h-6 md:-mt-0.5 bg-cover mr-1.5 float-left rounded-sm bg-[url(https://onwidget.com/favicon/favicon-32x32.png)]"
>
</span>
Made by <a class="text-blue-600 hover:underline dark:text-gray-200" href="https://onwidget.com/"> onWidget</a> ·
All rights reserved.
</div> </div>
</div> </div>
</div> </div>