Skip to content

Commit

Permalink
Merge pull request #87 from qwikerx/feat/banner-component
Browse files Browse the repository at this point in the history
feat: add banner component
  • Loading branch information
jcfauchet authored Jun 12, 2024
2 parents b445e45 + 55c510d commit 3e06aef
Show file tree
Hide file tree
Showing 16 changed files with 424 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export default component$(() => {
- Alert
- Avatar
- Badge
- Banner
- Breadcrumb
- Button
- Card
Expand Down
37 changes: 37 additions & 0 deletions apps/web/src/examples.ts

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions apps/web/src/routes/docs/components/banner/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { component$ } from '@builder.io/qwik'
import { ComponentDocPage } from '~/components/ComponentDocPage/ComponentDocPage'
import { DocumentHead } from '@builder.io/qwik-city'

export default component$(() => {
return (
<ComponentDocPage name="banner">
<div q:slot="explanation">
Get started with the sticky banner component coded with Tailwind CSS and Flowbite to show marketing, informational and CTA messages to your
website visitors fixed to the top or bottom part of the page as the user scroll down the main content area. Explore the following examples
based on various styles, sizes, and positionings to leverage the sticky banner component and increase marketing conversions with a responsive
element supporting dark mode.
</div>
</ComponentDocPage>
)
})

export const head: DocumentHead = () => ({
title: 'Qwik Banner - Flowbite',
})
7 changes: 5 additions & 2 deletions apps/web/src/routes/docs/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default component$(() => {
Quickstart
</SidebarItem>
</SidebarCollapse>
<SidebarCollapse label="Components" opened>
<SidebarCollapse label="Components (19)" opened>
<SidebarItem tag={NavLink} href="/docs/components/accordion">
Accordion
</SidebarItem>
Expand All @@ -48,6 +48,9 @@ export default component$(() => {
<SidebarItem tag={NavLink} href="/docs/components/badge">
Badge
</SidebarItem>
<SidebarItem tag={NavLink} href="/docs/components/banner">
Banner
</SidebarItem>
<SidebarItem tag={NavLink} href="/docs/components/breadcrumb">
Breadcrumb
</SidebarItem>
Expand Down Expand Up @@ -91,7 +94,7 @@ export default component$(() => {
Toast
</SidebarItem>
</SidebarCollapse>
<SidebarCollapse label="Form">
<SidebarCollapse label="Form (5)">
<SidebarItem tag={NavLink} href="/docs/components/checkbox">
Checkbox
</SidebarItem>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/**
* title: Default sticky banner
* description: Use this free example to show a text message for announcement with a CTA link, an icon element and a close button to dismiss the banner.
* height: 450
*/

import { component$ } from '@builder.io/qwik'
import { StaticGenerateHandler } from '@builder.io/qwik-city'
import { Banner, BannerCollapseButton } from 'flowbite-qwik'
import { staticGenerateHandler } from '~/routes/examples/[theme-rtl]/layout'
import { IconCloseOutline, IconShareNodesSolid } from 'flowbite-qwik-icons'

export default component$(() => {
return (
<div class="h-[440px]">
<Banner sticky="top">
<div class="flex w-full justify-between border-b border-gray-200 bg-gray-50 p-4 dark:border-gray-600 dark:bg-gray-700">
<div class="mx-auto flex items-center">
<p class="flex items-center text-sm font-normal text-gray-500 dark:text-gray-400">
<IconShareNodesSolid class="mr-4 h-4 w-4" />
<span class="[&_p]:inline">
New brand identity has been launched for the&nbsp;
<a
href="https://flowbite.com"
class="inline font-medium text-cyan-600 underline decoration-solid underline-offset-2 hover:no-underline dark:text-cyan-500"
>
Flowbite Library
</a>
</span>
</p>
</div>
<BannerCollapseButton color="light" class="border-0 bg-transparent text-gray-500 dark:text-gray-400">
<IconCloseOutline class="h-4 w-4" />
</BannerCollapseButton>
</div>
</Banner>
<div class="max-w-lg mx-auto">
<div role="status" class="my-7 animate-pulse">
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-48 mb-4"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[500px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[450px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[380px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px]"></div>
<span class="sr-only">Loading...</span>
</div>
<div role="status" class="max-w-lg mb-7 animate-pulse">
<div class="flex items-center justify-center w-full h-48 bg-gray-300 rounded dark:bg-gray-700">
<svg class="w-12 h-12 text-gray-200" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" viewBox="0 0 640 512">
<path d="M480 80C480 35.82 515.8 0 560 0C604.2 0 640 35.82 640 80C640 124.2 604.2 160 560 160C515.8 160 480 124.2 480 80zM0 456.1C0 445.6 2.964 435.3 8.551 426.4L225.3 81.01C231.9 70.42 243.5 64 256 64C268.5 64 280.1 70.42 286.8 81.01L412.7 281.7L460.9 202.7C464.1 196.1 472.2 192 480 192C487.8 192 495 196.1 499.1 202.7L631.1 419.1C636.9 428.6 640 439.7 640 450.9C640 484.6 612.6 512 578.9 512H55.91C25.03 512 .0006 486.1 .0006 456.1L0 456.1z"></path>
</svg>
</div>
<span class="sr-only">Loading...</span>
</div>
<div role="status" class="my-6 animate-pulse">
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[450px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[500px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[450px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[380px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px]"></div>
<span class="sr-only">Loading...</span>
</div>
<div role="status" class="my-6 animate-pulse">
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[450px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[500px] mb-2.5"></div>
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
)
})

export const onStaticGenerate: StaticGenerateHandler = async () => {
return staticGenerateHandler()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/**
* title: Bottom banner position
* description: This example can be used to position the sticky banner to the bottom side of the page instead of the top side.
* height: 450
*/

import { component$ } from '@builder.io/qwik'
import { StaticGenerateHandler } from '@builder.io/qwik-city'
import { Banner, BannerCollapseButton } from 'flowbite-qwik'
import { IconArrowRightOutline, IconCloseOutline, IconSalePercentOutline } from 'flowbite-qwik-icons'
import { staticGenerateHandler } from '~/routes/examples/[theme-rtl]/layout'

export default component$(() => {
return (
<div class="h-[440px]">
<Banner sticky="bottom">
<div class="flex w-full justify-between border-b border-gray-200 bg-gray-50 p-4 dark:border-gray-600 dark:bg-gray-700">
<div class="mx-auto flex items-center">
<p class="flex items-center text-sm font-normal text-gray-500 dark:text-gray-400">
<span class="mr-3 inline-flex h-6 w-6 items-center justify-center rounded-full bg-gray-200 p-1 dark:bg-gray-600">
<IconSalePercentOutline class="h-4 w-4" />
</span>
<span class="[&_p]:inline">
Get 5% commision per sale&nbsp;
<a
href="https://flowbite.com"
class="ml-0 flex items-center text-sm font-medium text-cyan-600 hover:underline dark:text-cyan-500 md:ml-1 md:inline-flex"
>
Become a partner
<IconArrowRightOutline class="ml-2" />
</a>
</span>
</p>
</div>
<BannerCollapseButton color="light" class="border-0 bg-transparent text-gray-500 dark:text-gray-400">
<IconCloseOutline class="h-4 w-4" />
</BannerCollapseButton>
</div>
</Banner>
<div class="max-w-lg mx-auto">
<div role="status" class="my-7 animate-pulse">
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-48 mb-4"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[500px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[450px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[380px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px]"></div>
<span class="sr-only">Loading...</span>
</div>
<div role="status" class="max-w-lg mb-7 animate-pulse">
<div class="flex items-center justify-center w-full h-48 bg-gray-300 rounded dark:bg-gray-700">
<svg class="w-12 h-12 text-gray-200" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" viewBox="0 0 640 512">
<path d="M480 80C480 35.82 515.8 0 560 0C604.2 0 640 35.82 640 80C640 124.2 604.2 160 560 160C515.8 160 480 124.2 480 80zM0 456.1C0 445.6 2.964 435.3 8.551 426.4L225.3 81.01C231.9 70.42 243.5 64 256 64C268.5 64 280.1 70.42 286.8 81.01L412.7 281.7L460.9 202.7C464.1 196.1 472.2 192 480 192C487.8 192 495 196.1 499.1 202.7L631.1 419.1C636.9 428.6 640 439.7 640 450.9C640 484.6 612.6 512 578.9 512H55.91C25.03 512 .0006 486.1 .0006 456.1L0 456.1z"></path>
</svg>
</div>
<span class="sr-only">Loading...</span>
</div>
<div role="status" class="my-6 animate-pulse">
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[450px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[500px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[450px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[380px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px]"></div>
<span class="sr-only">Loading...</span>
</div>
<div role="status" class="my-6 animate-pulse">
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[450px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[500px] mb-2.5"></div>
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
)
})

export const onStaticGenerate: StaticGenerateHandler = async () => {
return staticGenerateHandler()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/**
* title: Marketing CTA banner
* description: Use this free example to show a text message for announcement with a CTA link, an icon element and a close button to dismiss the banner. Set a different width by using the max-w-{*} utility classes from Tailwind CSS.
* height: 450
*/

import { component$ } from '@builder.io/qwik'
import { StaticGenerateHandler } from '@builder.io/qwik-city'
import { Banner, BannerCollapseButton, Button } from 'flowbite-qwik'
import { IconCloseSolid } from 'flowbite-qwik-icons'
import { staticGenerateHandler } from '~/routes/examples/[theme-rtl]/layout'

export default component$(() => {
return (
<div class="h-[440px]">
<Banner sticky="top">
<div class="flex w-[calc(100%-2rem)] flex-col justify-between rounded-lg border border-gray-100 bg-white p-4 shadow-sm dark:border-gray-600 dark:bg-gray-700 md:flex-row lg:max-w-7xl">
<div class="mb-3 mr-4 flex flex-col items-start md:mb-0 md:flex-row md:items-center">
<a href="https://flowbite.com/" class="mb-2 flex items-center border-gray-200 dark:border-gray-600 md:mb-0 md:mr-4 md:border-r md:pr-4">
<img src="https://flowbite.com/docs/images/logo.svg" class="mr-2 h-6" alt="Flowbite Logo" />
<span class="self-center whitespace-nowrap text-lg font-semibold dark:text-white md:pr-6">Flowbite</span>
</a>
<p class="flex items-center text-sm font-normal text-gray-500 dark:text-gray-400">
Build websites even faster with components on top of Tailwind CSS
</p>
</div>
<div class="flex shrink-0 items-center">
<Button href="#">Sign up</Button>
<BannerCollapseButton color="light" class="border-0 bg-transparent text-gray-500 dark:text-gray-400">
<IconCloseSolid class="h-4 w-4" />
</BannerCollapseButton>
</div>
</div>
</Banner>
<div class="max-w-lg mx-auto">
<div role="status" class="my-7 animate-pulse">
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-48 mb-4"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[500px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[450px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[380px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px]"></div>
<span class="sr-only">Loading...</span>
</div>
<div role="status" class="max-w-lg mb-7 animate-pulse">
<div class="flex items-center justify-center w-full h-48 bg-gray-300 rounded dark:bg-gray-700">
<svg class="w-12 h-12 text-gray-200" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" viewBox="0 0 640 512">
<path d="M480 80C480 35.82 515.8 0 560 0C604.2 0 640 35.82 640 80C640 124.2 604.2 160 560 160C515.8 160 480 124.2 480 80zM0 456.1C0 445.6 2.964 435.3 8.551 426.4L225.3 81.01C231.9 70.42 243.5 64 256 64C268.5 64 280.1 70.42 286.8 81.01L412.7 281.7L460.9 202.7C464.1 196.1 472.2 192 480 192C487.8 192 495 196.1 499.1 202.7L631.1 419.1C636.9 428.6 640 439.7 640 450.9C640 484.6 612.6 512 578.9 512H55.91C25.03 512 .0006 486.1 .0006 456.1L0 456.1z"></path>
</svg>
</div>
<span class="sr-only">Loading...</span>
</div>
<div role="status" class="my-6 animate-pulse">
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[450px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[500px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[450px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[380px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px]"></div>
<span class="sr-only">Loading...</span>
</div>
<div role="status" class="my-6 animate-pulse">
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[450px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[460px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[500px] mb-2.5"></div>
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
)
})

export const onStaticGenerate: StaticGenerateHandler = async () => {
return staticGenerateHandler()
}
Loading

0 comments on commit 3e06aef

Please sign in to comment.