Refactor components structure
This commit is contained in:
2
src/components/atoms/ExtraMetaTags.astro
Normal file
2
src/components/atoms/ExtraMetaTags.astro
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
---
|
7
src/components/atoms/Fonts.astro
Normal file
7
src/components/atoms/Fonts.astro
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Google Fonts -->
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;700&display=swap" rel="stylesheet" />
|
@ -6,6 +6,8 @@ import GoogleAnalytics from "~/components/core/GoogleAnalytics.astro";
|
|||||||
import defaultImageSrc from "~/assets/images/default.png";
|
import defaultImageSrc from "~/assets/images/default.png";
|
||||||
|
|
||||||
import { SITE } from "~/config.mjs";
|
import { SITE } from "~/config.mjs";
|
||||||
|
import Fonts from "../atoms/Fonts.astro";
|
||||||
|
import ExtraMetaTags from "../atoms/ExtraMetaTags.astro";
|
||||||
|
|
||||||
const { src: defaultImage } = await getImage({
|
const { src: defaultImage } = await getImage({
|
||||||
src: defaultImageSrc,
|
src: defaultImageSrc,
|
||||||
@ -59,13 +61,12 @@ const image =
|
|||||||
<meta name="twitter:description" content={description} />
|
<meta name="twitter:description" content={description} />
|
||||||
{image && <meta name="twitter:image" content={image} />}
|
{image && <meta name="twitter:image" content={image} />}
|
||||||
|
|
||||||
<!-- Google Fonts -->
|
<Fonts />
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;700&display=swap" rel="stylesheet" />
|
|
||||||
|
|
||||||
<!-- Google Site Verification -->
|
<!-- Google Site Verification -->
|
||||||
{SITE.googleSiteVerificationId && <meta name="google-site-verification" content={SITE.googleSiteVerificationId} />}
|
{SITE.googleSiteVerificationId && <meta name="google-site-verification" content={SITE.googleSiteVerificationId} />}
|
||||||
|
|
||||||
<!-- Google Analytics -->
|
<!-- Google Analytics -->
|
||||||
{SITE.googleAnalyticsId && <GoogleAnalytics id={SITE.googleAnalyticsId} partytown={true} />}
|
{SITE.googleAnalyticsId && <GoogleAnalytics id={SITE.googleAnalyticsId} partytown={true} />}
|
||||||
|
|
||||||
|
<ExtraMetaTags />
|
||||||
|
28
src/components/core/ToggleMenu.astro
Normal file
28
src/components/core/ToggleMenu.astro
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
import { Icon } from "astro-icon";
|
||||||
|
|
||||||
|
const {
|
||||||
|
label = "Toggle Menu",
|
||||||
|
class:
|
||||||
|
className = "ml-1.5 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 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 transition",
|
||||||
|
iconClass = "w-6 h-6",
|
||||||
|
iconName = "tabler:menu",
|
||||||
|
} = Astro.props;
|
||||||
|
---
|
||||||
|
|
||||||
|
<button type="button" class={className} aria-label={label} data-aw-toggle-menu>
|
||||||
|
<Icon name={iconName} class={iconClass} optimize={false} />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<style is:global>
|
||||||
|
[data-aw-toggle-menu] path {
|
||||||
|
@apply transition;
|
||||||
|
}
|
||||||
|
[data-aw-toggle-menu].expanded g > path:first-child {
|
||||||
|
@apply -rotate-45 translate-y-[15px] translate-x-[-3px];
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-aw-toggle-menu].expanded g > path:last-child {
|
||||||
|
@apply rotate-45 translate-y-[-8px] translate-x-[14px];
|
||||||
|
}
|
||||||
|
</style>
|
15
src/components/core/ToggleTheme.astro
Normal file
15
src/components/core/ToggleTheme.astro
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
import { Icon } from "astro-icon";
|
||||||
|
|
||||||
|
const {
|
||||||
|
label = "Toggle between Dark and Light mode",
|
||||||
|
class:
|
||||||
|
className = "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",
|
||||||
|
iconClass = "w-6 h-6",
|
||||||
|
iconName = "tabler:sun",
|
||||||
|
} = Astro.props;
|
||||||
|
---
|
||||||
|
|
||||||
|
<button type="button" class={className} aria-label={label} data-aw-toggle-color-scheme>
|
||||||
|
<Icon name={iconName} class={iconClass} />
|
||||||
|
</button>
|
@ -23,7 +23,7 @@ const {} = Astro.props;
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener"
|
rel="noopener"
|
||||||
>
|
>
|
||||||
<Icon name="tabler:download" class="w-5 h-5 mr-1 hidden sm:inline-block" /> Get template
|
<Icon name="tabler:download" class="w-5 h-5 mr-1 -ml-1.5 hidden sm:inline-block" /> Get template
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -70,7 +70,7 @@ const items = [
|
|||||||
<path
|
<path
|
||||||
class="stroke-current text-primary-300"
|
class="stroke-current text-primary-300"
|
||||||
d="M38.858 26.993l6.397 1.73-4.473 16.549-13.24-3.58"
|
d="M38.858 26.993l6.397 1.73-4.473 16.549-13.24-3.58"
|
||||||
></path>
|
/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
import { Icon } from "astro-icon";
|
import { Icon } from "astro-icon";
|
||||||
|
|
||||||
const {} = Astro.props;
|
const {} = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -27,7 +28,7 @@ const {} = Astro.props;
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener"
|
rel="noopener"
|
||||||
>
|
>
|
||||||
<Icon name="tabler:download" class="w-5 h-5 mr-1 hidden sm:inline-block" /> Get template
|
<Icon name="tabler:download" class="w-5 h-5 mr-1 -ml-1.5 hidden sm:inline-block" /> Get template
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -1,6 +1,8 @@
|
|||||||
---
|
---
|
||||||
import { Icon } from "astro-icon";
|
import { Icon } from "astro-icon";
|
||||||
import Logo from "~/components/widgets/Logo.astro";
|
import Logo from "~/components/atoms/Logo.astro";
|
||||||
|
import ToggleTheme from "../core/ToggleTheme.astro";
|
||||||
|
import ToggleMenu from "../core/ToggleMenu.astro";
|
||||||
|
|
||||||
import { getPermalink, getBlogPermalink, getHomePermalink } from "~/utils/permalinks";
|
import { getPermalink, getBlogPermalink, getHomePermalink } from "~/utils/permalinks";
|
||||||
|
|
||||||
@ -16,21 +18,8 @@ const {} = Astro.props;
|
|||||||
<Logo />
|
<Logo />
|
||||||
</a>
|
</a>
|
||||||
<div class="flex items-center md:hidden">
|
<div class="flex items-center md:hidden">
|
||||||
<button
|
<ToggleTheme />
|
||||||
type="button"
|
<ToggleMenu />
|
||||||
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="Toggle between Dark and Light mode"
|
|
||||||
data-aw-toggle-color-scheme
|
|
||||||
>
|
|
||||||
<Icon name="tabler:sun" class="w-6 h-6" />
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
class="ml-1.5 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 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 transition"
|
|
||||||
aria-label="Toggle Menu"
|
|
||||||
data-aw-toggle-menu
|
|
||||||
>
|
|
||||||
<Icon name="tabler:menu" class="w-6 h-6" optimize={false} />
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<nav
|
<nav
|
||||||
@ -72,14 +61,7 @@ const {} = Astro.props;
|
|||||||
</ul>
|
</ul>
|
||||||
<div class="md:self-center flex items-center mb-4 md:mb-0 ml-2">
|
<div class="md:self-center flex items-center mb-4 md:mb-0 ml-2">
|
||||||
<div class="hidden items-center md:flex">
|
<div class="hidden items-center md:flex">
|
||||||
<button
|
<ToggleTheme iconClass="w-5 h-5" />
|
||||||
type="button"
|
|
||||||
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="Toggle between Dark and Light mode"
|
|
||||||
data-aw-toggle-color-scheme
|
|
||||||
>
|
|
||||||
<Icon name="tabler:sun" class="w-5 h-5" />
|
|
||||||
</button>
|
|
||||||
<a
|
<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"
|
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"
|
aria-label="RSS Feed"
|
||||||
@ -99,16 +81,3 @@ const {} = Astro.props;
|
|||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<style is:global>
|
|
||||||
[data-aw-toggle-menu] path {
|
|
||||||
@apply transition;
|
|
||||||
}
|
|
||||||
[data-aw-toggle-menu].expanded g > path:first-child {
|
|
||||||
@apply -rotate-45 translate-y-[15px] translate-x-[-3px];
|
|
||||||
}
|
|
||||||
|
|
||||||
[data-aw-toggle-menu].expanded g > path:last-child {
|
|
||||||
@apply rotate-45 translate-y-[-8px] translate-x-[14px];
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
@ -31,7 +31,7 @@ const {} = Astro.props;
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener"
|
rel="noopener"
|
||||||
>
|
>
|
||||||
<Icon name="tabler:download" class="w-5 h-5 mr-1 hidden sm:inline-block" /> Get template
|
<Icon name="tabler:download" class="w-5 h-5 mr-1 -ml-1.5 hidden sm:inline-block" /> Get template
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
import BlogListItem from "~/components/widgets/BlogListItem.astro";
|
import Item from "~/components/widgets/blog/ListItem.astro";
|
||||||
|
|
||||||
const { posts } = Astro.props;
|
const { posts } = Astro.props;
|
||||||
---
|
---
|
||||||
@ -8,7 +8,7 @@ const { posts } = Astro.props;
|
|||||||
{
|
{
|
||||||
posts.map((post) => (
|
posts.map((post) => (
|
||||||
<li class="mb-10 md:mb-16">
|
<li class="mb-10 md:mb-16">
|
||||||
<BlogListItem post={post} />
|
<Item post={post} />
|
||||||
</li>
|
</li>
|
||||||
))
|
))
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
import Picture from "~/components/core/Picture.astro";
|
import Picture from "~/components/core/Picture.astro";
|
||||||
import PostTags from "~/components/widgets/PostTags.astro";
|
import PostTags from "~/components/atoms/Tags.astro";
|
||||||
|
|
||||||
import { getPermalink } from "~/utils/permalinks";
|
import { getPermalink } from "~/utils/permalinks";
|
||||||
import { findImage } from "~/utils/images";
|
import { findImage } from "~/utils/images";
|
@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
import Picture from "~/components/core/Picture.astro";
|
import Picture from "~/components/core/Picture.astro";
|
||||||
import PostTags from "~/components/widgets/PostTags.astro";
|
import PostTags from "~/components/atoms/Tags.astro";
|
||||||
|
|
||||||
import { getFormattedDate } from "~/utils/utils";
|
import { getFormattedDate } from "~/utils/utils";
|
||||||
|
|
||||||
const { post } = Astro.props;
|
const { post } = Astro.props;
|
@ -2,8 +2,8 @@
|
|||||||
import { SITE, BLOG } from "~/config.mjs";
|
import { SITE, BLOG } from "~/config.mjs";
|
||||||
|
|
||||||
import Layout from "~/layouts/BlogLayout.astro";
|
import Layout from "~/layouts/BlogLayout.astro";
|
||||||
import BlogList from "~/components/widgets/BlogList.astro";
|
import BlogList from "~/components/widgets/blog/List.astro";
|
||||||
import Pagination from "~/components/widgets/Pagination.astro";
|
import Pagination from "~/components/atoms/Pagination.astro";
|
||||||
|
|
||||||
import { fetchPosts } from "~/utils/posts";
|
import { fetchPosts } from "~/utils/posts";
|
||||||
import { getCanonical, getPermalink, BLOG_BASE } from "~/utils/permalinks";
|
import { getCanonical, getPermalink, BLOG_BASE } from "~/utils/permalinks";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import { SITE, BLOG } from "~/config.mjs";
|
import { SITE, BLOG } from "~/config.mjs";
|
||||||
|
|
||||||
import Layout from "~/layouts/PageLayout.astro";
|
import Layout from "~/layouts/PageLayout.astro";
|
||||||
import BlogPost from "~/components/widgets/BlogPost.astro";
|
import SinglePost from "~/components/widgets/blog/SinglePost.astro";
|
||||||
|
|
||||||
import { getCanonical, getPermalink, cleanSlug, BLOG_BASE } from "~/utils/permalinks";
|
import { getCanonical, getPermalink, cleanSlug, BLOG_BASE } from "~/utils/permalinks";
|
||||||
import { fetchPosts } from "~/utils/posts";
|
import { fetchPosts } from "~/utils/posts";
|
||||||
@ -30,5 +30,5 @@ const meta = {
|
|||||||
---
|
---
|
||||||
|
|
||||||
<Layout meta={meta}>
|
<Layout meta={meta}>
|
||||||
<BlogPost post={{ ...post, image: meta.image }} />
|
<SinglePost post={{ ...post, image: meta.image }} />
|
||||||
</Layout>
|
</Layout>
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
import { SITE, BLOG } from "~/config.mjs";
|
import { SITE, BLOG } from "~/config.mjs";
|
||||||
|
|
||||||
import Layout from "~/layouts/BlogLayout.astro";
|
import Layout from "~/layouts/BlogLayout.astro";
|
||||||
import BlogList from "~/components/widgets/BlogList.astro";
|
import BlogList from "~/components/widgets/blog/List.astro";
|
||||||
import Pagination from "~/components/widgets/Pagination.astro";
|
import Pagination from "~/components/atoms/Pagination.astro";
|
||||||
|
|
||||||
import { fetchPosts } from "~/utils/posts";
|
import { fetchPosts } from "~/utils/posts";
|
||||||
import { getCanonical, getPermalink, cleanSlug, CATEGORY_BASE } from "~/utils/permalinks";
|
import { getCanonical, getPermalink, cleanSlug, CATEGORY_BASE } from "~/utils/permalinks";
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
import { SITE, BLOG } from "~/config.mjs";
|
import { SITE, BLOG } from "~/config.mjs";
|
||||||
|
|
||||||
import Layout from "~/layouts/BlogLayout.astro";
|
import Layout from "~/layouts/BlogLayout.astro";
|
||||||
import BlogList from "~/components/widgets/BlogList.astro";
|
import BlogList from "~/components/widgets/blog/List.astro";
|
||||||
import Pagination from "~/components/widgets/Pagination.astro";
|
import Pagination from "~/components/atoms/Pagination.astro";
|
||||||
|
|
||||||
import { fetchPosts } from "~/utils/posts";
|
import { fetchPosts } from "~/utils/posts";
|
||||||
import { getCanonical, getPermalink, cleanSlug, TAG_BASE } from "~/utils/permalinks";
|
import { getCanonical, getPermalink, cleanSlug, TAG_BASE } from "~/utils/permalinks";
|
||||||
|
@ -4,14 +4,14 @@ import { getCanonical, getHomePermalink } from "~/utils/permalinks";
|
|||||||
import Layout from "~/layouts/PageLayout.astro";
|
import Layout from "~/layouts/PageLayout.astro";
|
||||||
|
|
||||||
import Hero from "~/components/widgets/Hero.astro";
|
import Hero from "~/components/widgets/Hero.astro";
|
||||||
import BasicCTA from "~/components/widgets/BasicCTA.astro";
|
import Features from "~/components/widgets/Features.astro";
|
||||||
import BasicFeatures from "~/components/widgets/BasicFeatures.astro";
|
import Features2 from "~/components/widgets/Features2.astro";
|
||||||
import StepsFeatures from "~/components/widgets/StepsFeatures.astro";
|
import Steps from "~/components/widgets/Steps.astro";
|
||||||
|
import Features3 from "~/components/widgets/Features3.astro";
|
||||||
|
import HighlightedPosts from "~/components/widgets/blog/HighlightedPosts.astro";
|
||||||
import FAQs from "~/components/widgets/FAQs.astro";
|
import FAQs from "~/components/widgets/FAQs.astro";
|
||||||
import TwoColsFeatures from "~/components/widgets/TwoColsFeatures.astro";
|
|
||||||
import StepsLeft from "~/components/widgets/StepsLeft.astro";
|
|
||||||
import HighlightedPosts from "~/components/widgets/HighlightedPosts.astro";
|
|
||||||
import Stats from "~/components/widgets/Stats.astro";
|
import Stats from "~/components/widgets/Stats.astro";
|
||||||
|
import CallToAction from "~/components/widgets/CallToAction.astro";
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: SITE.title,
|
title: SITE.title,
|
||||||
@ -22,12 +22,12 @@ const meta = {
|
|||||||
|
|
||||||
<Layout meta={meta}>
|
<Layout meta={meta}>
|
||||||
<Hero />
|
<Hero />
|
||||||
<BasicFeatures />
|
<Features />
|
||||||
<StepsLeft />
|
<Steps />
|
||||||
<TwoColsFeatures />
|
<Features2 />
|
||||||
<StepsFeatures />
|
<Features3 />
|
||||||
<HighlightedPosts />
|
<HighlightedPosts />
|
||||||
<FAQs />
|
<FAQs />
|
||||||
<Stats />
|
<Stats />
|
||||||
<BasicCTA />
|
<CallToAction />
|
||||||
</Layout>
|
</Layout>
|
||||||
|
Reference in New Issue
Block a user