Add Hero and Footer Components (#947)

This commit is contained in:
hashrock
2022-12-16 20:43:12 +09:00
committed by GitHub
parent 6c9b5ed316
commit 026c1affd7
7 changed files with 100 additions and 2 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ export default function Button(props: JSX.HTMLAttributes<HTMLButtonElement>) {
<button
{...props}
disabled={!IS_BROWSER || props.disabled}
class={`px-3 py-2 bg-white rounded border(gray-500 2) hover:bg-gray-200 disabled:(opacity-50 cursor-not-allowed) ${
class={`px-3 py-2 bg-white rounded border(gray-500 2) hover:bg-gray-200 active:bg-gray-300 disabled:(opacity-50 cursor-not-allowed) ${
props.class ?? ""
}`}
/>
+1 -1
View File
@@ -8,7 +8,7 @@ export default function ColoredButton(
<button
{...props}
disabled={!IS_BROWSER || props.disabled}
class="px-3 py-2 bg-blue-200 text-blue-800 rounded hover:bg-blue-300"
class="px-3 py-2 bg-blue-200 text-blue-800 rounded hover:bg-blue-300 active:bg-blue-400"
/>
);
}
+52
View File
@@ -0,0 +1,52 @@
import IconAlarm from "https://deno.land/x/tabler_icons_tsx@0.0.2/tsx/alarm.tsx";
import IconAirBalloon from "https://deno.land/x/tabler_icons_tsx@0.0.2/tsx/air-balloon.tsx";
import IconArmchair from "https://deno.land/x/tabler_icons_tsx@0.0.2/tsx/armchair.tsx";
import IconChevronRight from "https://deno.land/x/tabler_icons_tsx@0.0.2/tsx/chevron-right.tsx";
export default function Features() {
const featureItems = [
{
icon: IconAlarm,
description:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc ut aliquam aliquam",
link: "#",
},
{
icon: IconAirBalloon,
description:
"Nunc nisl aliquet nisl, eget aliquam nisl nisl sit amet lorem. Sed euismod, nunc ut aliquam aliquam, nunc nisl aliquet nisl, ",
},
{
icon: IconArmchair,
description: "Eget aliquam nisl nisl sit amet lorem.",
link: "#",
},
];
return (
<div class="flex flex-col md:flex-row gap-8 bg-white p-8">
{featureItems.map((item) => {
return (
<div class="flex-1 space-y-2">
<div class="bg-blue-600 inline-block p-3 rounded-xl text-white">
<item.icon class="w-10 h-10" />
</div>
<p class="text-xl">
{item.description}
</p>
{item.link &&
(
<a class="block" href={item.link}>
<p class="text-blue-500 cursor-pointer hover:underline inline-flex items-center group">
Read More{" "}
<IconChevronRight class="inline-block w-5 h-5 transition group-hover:translate-x-0.5" />
</p>
</a>
)}
</div>
);
})}
</div>
);
}
+34
View File
@@ -0,0 +1,34 @@
import IconChevronRight from "https://deno.land/x/tabler_icons_tsx@0.0.2/tsx/chevron-right.tsx";
export default function Hero() {
return (
<div
class="w-full flex px-8 h-96 justify-center items-center flex-col gap-8 bg-cover bg-center bg-no-repeat bg-gray-100 rounded-xl text-white"
style="background-image:linear-gradient(rgba(0, 0, 40, 0.8),rgba(0, 0, 40, 0.8)), url('/gallery/hero-bg.webp');"
>
<div class="space-y-4 text-center">
<h1 class="text-4xl inline-block font-bold">Fresh Components Beta</h1>
<p class="text-xl max-w-lg text-blue-100">
Fresh Components is a collection of components built with Preact and
Tailwind CSS.
</p>
</div>
<div>
<a
href="#"
class="block mt-4 text-blue-500 cursor-pointer inline-flex items-center group text-blue-800 bg-white px-8 py-2 rounded-md hover:bg-blue-50 font-bold"
>
Sign Up{" "}
</a>
<a
href="#"
class="block mt-4 transition-colors text-blue-400 cursor-pointer inline-flex items-center group px-4 py-2 hover:text-blue-100"
>
Documentation{" "}
<IconChevronRight class="inline-block w-5 h-5 transition group-hover:translate-x-0.5" />
</a>
</div>
</div>
);
}
+10
View File
@@ -4,6 +4,8 @@ import ColoredButton from "../components/gallery/ColoredButton.tsx";
import Input from "../components/gallery/Input.tsx";
import Header from "../components/gallery/Header.tsx";
import Footer from "../components/gallery/Footer.tsx";
import Hero from "../components/gallery/Hero.tsx";
import Features from "../components/gallery/Features.tsx";
import { ComponentChildren } from "preact";
import IconHappy from "https://deno.land/x/tabler_icons_tsx@0.0.2/tsx/mood-crazy-happy.tsx";
import IconHeart from "https://deno.land/x/tabler_icons_tsx@0.0.2/tsx/heart.tsx";
@@ -100,6 +102,14 @@ export default function ComponentGallery(props: ComponentGalleryProps) {
<Footer>
</Footer>
</Section>
<Section title="Hero" source={props.sources.Hero}>
<Hero />
</Section>
<Section title="Features" source={props.sources.Features}>
<Features />
</Section>
</>
);
}
+2
View File
@@ -21,6 +21,8 @@ export const handler: Handlers<HomeProps> = {
"Input": await getSource("../components/gallery/Input.tsx"),
"Header": await getSource("../components/gallery/Header.tsx"),
"Footer": await getSource("../components/gallery/Footer.tsx"),
"Hero": await getSource("../components/gallery/Hero.tsx"),
"Features": await getSource("../components/gallery/Features.tsx"),
},
};
return ctx.render(props);
Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB