Improve design and extract data
This commit is contained in:
@ -4,51 +4,33 @@ import Logo from '~/components/common/Logo.astro';
|
||||
import ToggleTheme from '~/components/common/ToggleTheme.astro';
|
||||
import ToggleMenu from '~/components/common/ToggleMenu.astro';
|
||||
|
||||
import { getHomePermalink, getBlogPermalink, getPermalink, getAsset } from '~/utils/permalinks';
|
||||
import { getHomePermalink, getAsset } from '~/utils/permalinks';
|
||||
|
||||
const links = [
|
||||
{
|
||||
text: 'Pages',
|
||||
links: [
|
||||
{
|
||||
text: 'Features',
|
||||
href: '#',
|
||||
},
|
||||
{
|
||||
text: 'Pricing',
|
||||
href: '#',
|
||||
},
|
||||
{
|
||||
text: 'About us',
|
||||
href: '#',
|
||||
},
|
||||
{
|
||||
text: 'Contact',
|
||||
href: '#',
|
||||
},
|
||||
{
|
||||
text: 'Terms',
|
||||
href: getPermalink('/terms'),
|
||||
},
|
||||
{
|
||||
text: 'Privacy policy',
|
||||
href: getPermalink('/privacy'),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: 'Resources',
|
||||
href: getPermalink('useful-resources-to-create-websites', 'post'),
|
||||
},
|
||||
{
|
||||
text: 'Blog',
|
||||
href: getBlogPermalink(),
|
||||
},
|
||||
];
|
||||
interface Link {
|
||||
text?: string;
|
||||
href?: string;
|
||||
ariaLabel?: string;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
interface ActionLink extends Link {
|
||||
type?: string;
|
||||
}
|
||||
|
||||
interface MenuLink extends Link {
|
||||
links?: Array<Link>;
|
||||
}
|
||||
|
||||
export interface Props {
|
||||
links: Array<MenuLink>;
|
||||
actions: Array<ActionLink>;
|
||||
}
|
||||
|
||||
const { links = [], actions = [] } = Astro.props;
|
||||
---
|
||||
|
||||
<header class="sticky top-0 z-40 flex-none mx-auto w-full transition-all ease-in duration-100" id="header">
|
||||
<div class="py-3 px-3 md:py-3.5 md:px-4 mx-auto w-full md:flex md:justify-between max-w-6xl">
|
||||
<div class="py-3 px-3 md:py-3.5 md:px-4 mx-auto w-full md:flex md:justify-between max-w-screen-xl">
|
||||
<div class="flex justify-between">
|
||||
<a class="flex items-center" href={getHomePermalink()}>
|
||||
<Logo />
|
||||
@ -59,7 +41,7 @@ const links = [
|
||||
</div>
|
||||
</div>
|
||||
<nav
|
||||
class="items-center w-full md:w-auto hidden md:flex text-gray-600 dark:text-slate-200 h-[calc(100vh-72px)] md:h-auto overflow-y-auto md:overflow-visible"
|
||||
class="items-center w-full md:w-auto hidden md:flex text-gray-800 dark:text-slate-200 h-[calc(100vh-72px)] md:h-auto overflow-y-auto md:overflow-visible"
|
||||
aria-label="Main navigation"
|
||||
>
|
||||
<ul class="flex flex-col pt-8 md:pt-0 md:flex-row md:self-center w-full md:w-auto text-xl md:text-base">
|
||||
@ -71,11 +53,11 @@ const links = [
|
||||
<button class="font-medium hover:text-gray-900 dark:hover:text-white px-4 py-3 flex items-center transition duration-150 ease-in-out">
|
||||
{text} <Icon name="tabler:chevron-down" class="w-3.5 h-3.5 ml-0.5 hidden md:inline" />
|
||||
</button>
|
||||
<ul class="dropdown-menu rounded md:absolute pl-4 md:pl-0 md:hidden font-medium md:bg-white md:min-w-[200px] dark:md:bg-slate-800 drop-shadow-xl">
|
||||
<ul class="dropdown-menu md:backdrop-blur-md dark:md:bg-dark rounded md:absolute pl-4 md:pl-0 md:hidden font-medium md:bg-white/90 md:min-w-[200px] drop-shadow-xl">
|
||||
{links.map(({ text: text2, href: href2 }) => (
|
||||
<li>
|
||||
<a
|
||||
class="first:rounded-t last:rounded-b md:hover:bg-gray-100 dark:hover:bg-gray-700 py-2 px-5 block whitespace-no-wrap"
|
||||
class="first:rounded-t last:rounded-b md:hover:bg-gray-200 dark:hover:bg-gray-700 py-2 px-5 block whitespace-no-wrap"
|
||||
href={href2}
|
||||
>
|
||||
{text2}
|
||||
@ -95,29 +77,39 @@ const links = [
|
||||
</li>
|
||||
))
|
||||
}
|
||||
<li class="md:hidden">
|
||||
<a
|
||||
class="font-bold hover:text-gray-900 dark:hover:text-white px-4 py-3 flex items-center transition duration-150 ease-in-out"
|
||||
href="https://github.com/onwidget/astrowind">Github</a
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="md:self-center flex items-center md:mb-0 ml-4">
|
||||
<div class="hidden items-center md:flex">
|
||||
<ToggleTheme iconClass="w-5 h-5" />
|
||||
<a
|
||||
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"
|
||||
aria-label="RSS Feed"
|
||||
href={getAsset('/rss.xml')}
|
||||
>
|
||||
<Icon name="tabler:rss" class="w-5 h-5" />
|
||||
</a>
|
||||
<a
|
||||
class="btn w-full ml-3 py-2.5 px-5 font-semibold text-gray-600 shadow-none text-sm"
|
||||
href="https://github.com/onwidget/astrowind">Download</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="md:self-center flex items-center md:mb-0">
|
||||
<div class="hidden items-center md:flex">
|
||||
<ToggleTheme iconClass="w-5 h-5" />
|
||||
|
||||
<a
|
||||
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"
|
||||
aria-label="RSS Feed"
|
||||
href={getAsset('/rss.xml')}
|
||||
>
|
||||
<Icon name="tabler:rss" class="w-5 h-5" />
|
||||
</a>
|
||||
{
|
||||
actions?.length ? (
|
||||
<span class="ml-4">
|
||||
{actions.map(({ text, href, type }) => (
|
||||
<a
|
||||
class:list={[
|
||||
'btn ml-2 py-2.5 px-5.5 md:px-6 font-semibold shadow-none text-sm',
|
||||
{ 'btn-ghost': type === 'ghost', 'btn-primary': type === 'primary' },
|
||||
]}
|
||||
href={href}
|
||||
>
|
||||
<Fragment set:html={text} />
|
||||
</a>
|
||||
))}
|
||||
</span>
|
||||
) : (
|
||||
''
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
Reference in New Issue
Block a user