Skip to content

Commit

Permalink
Component Anchor for create links
Browse files Browse the repository at this point in the history
  • Loading branch information
brendonguedes committed Jun 14, 2023
1 parent 9dc98a3 commit 24fb74d
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 14 deletions.
10 changes: 9 additions & 1 deletion components/header/Alert.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Slider from "$store/components/ui/Slider.tsx";
import Anchor from "$store/components/ui/Anchor.tsx";
import SliderJS from "$store/islands/SliderJS.tsx";
import { useId } from "preact/hooks";

Expand All @@ -20,7 +21,14 @@ function Alert({ alerts = [], interval = 5 }: Props) {
{alerts.map((alert, index) => (
<Slider.Item index={index} class="carousel-item">
<span class="text-sm text-secondary-content flex justify-center items-center w-screen h-[38px]">
{alert}
<Anchor
href="/"
class="flex-grow inline-flex items-center"
aria-label="Alertas"
target="_blank"
>
{alert}
</Anchor>
</span>
</Slider.Item>
))}
Expand Down
6 changes: 4 additions & 2 deletions components/header/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Searchbar from "$store/islands/HeaderSearchbar.tsx";
import Buttons from "$store/islands/HeaderButton.tsx";
import Icon from "$store/components/ui/Icon.tsx";
import Anchor from "$store/components/ui/Anchor.tsx";
import NavItem from "./NavItem.tsx";
import { navbarHeight } from "./constants.ts";
import type { INavItem } from "./NavItem.tsx";
Expand All @@ -19,14 +20,15 @@ function Navbar({ items, searchbar }: {
>
<Buttons variant="menu" />

<a
<Anchor
href="/"
class="flex-grow inline-flex items-center"
style={{ minHeight: navbarHeight }}
aria-label="Store logo"
target="_blank"
>
<Icon id="Logo" width={126} height={16} />
</a>
</Anchor>

<div class="flex gap-1">
<Buttons variant="search" />
Expand Down
33 changes: 33 additions & 0 deletions components/ui/Anchor.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { forwardRef } from "preact/compat";
import type { JSX } from "preact";

export type Props =
& Omit<JSX.IntrinsicElements["a"], "loading">
& {
loading?: boolean;
href?: string;
title?: string;
label?: string;
target: string;
};

const Anchor = forwardRef<HTMLAnchorElement, Props>(({
type = "a",
class: _class = "",
loading,
disabled,
children,
...props
}, ref) => (
<a
{...props}
className={`hover:underline text-sm flex gap-4${_class}`}
disabled={disabled || loading}
type={type}
ref={ref}
>
{loading ? <span class="loading loading-spinner" /> : children}
</a>
));

export default Anchor;
5 changes: 2 additions & 3 deletions import_map.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"imports": {
"deco-sites/intimissimi/": "./",

"deco-sites/fashion/": "./",
"$store/": "./",
"deco-sites/std/": "https://denopkg.com/deco-sites/std@1.9.29/",
"$live/": "https://denopkg.com/deco-cx/live@1.9.15/",
"$live/": "https://denopkg.com/deco-cx/live@1.9.17/",
"$fresh/": "https://denopkg.com/deco-cx/fresh@1.3.0/",
"preact": "https://esm.sh/preact@10.15.1",
"preact/": "https://esm.sh/preact@10.15.1/",
Expand All @@ -16,4 +15,4 @@
"partytown/": "https://denopkg.com/deco-cx/partytown@0.3.0/",
"daisyui": "npm:daisyui@3.0.3"
}
}
}
6 changes: 4 additions & 2 deletions live.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,10 @@ const manifest = {
"deco-sites/intimissimi/sections/Images/ShoppableBanner.tsx": $$$$$$$$4,
"deco-sites/intimissimi/sections/Links/LinkTree.tsx": $$$$$$$$20,
"deco-sites/intimissimi/sections/Links/Shortcuts.tsx": $$$$$$$$21,
"deco-sites/intimissimi/sections/Miscellaneous/CampaignTimer.tsx": $$$$$$$$16,
"deco-sites/intimissimi/sections/Miscellaneous/CookieConsent.tsx": $$$$$$$$17,
"deco-sites/intimissimi/sections/Miscellaneous/CampaignTimer.tsx":
$$$$$$$$16,
"deco-sites/intimissimi/sections/Miscellaneous/CookieConsent.tsx":
$$$$$$$$17,
"deco-sites/intimissimi/sections/Newsletter/Newsletter.tsx": $$$$$$$$22,
"deco-sites/intimissimi/sections/Product/ProductDetails.tsx": $$$$$$$$15,
"deco-sites/intimissimi/sections/Product/ProductShelf.tsx": $$$$$$$$14,
Expand Down
12 changes: 6 additions & 6 deletions schemas.gen.json
Original file line number Diff line number Diff line change
Expand Up @@ -8210,7 +8210,7 @@
"required": [],
"title": "OptionalColors"
},
"ZGVjby1zaXRlcy9pbnRpbWlzc2ltaS9zZWN0aW9ucy9EZXNpZ25TeXN0ZW0vRGVzaWduU3lzdGVtLnRzeA==@696524a6ff9e8fdff928f109587791e1&Colors": {
"ZGVjby1zaXRlcy9pbnRpbWlzc2ltaS9zZWN0aW9ucy9EZXNpZ25TeXN0ZW0vRGVzaWduU3lzdGVtLnRzeA==@425790340007221b61134a9094812da9&Colors": {
"allOf": [
{
"$ref": "#/definitions/ZGVjby1zaXRlcy9pbnRpbWlzc2ltaS9zZWN0aW9ucy9EZXNpZ25TeXN0ZW0vRGVzaWduU3lzdGVtLnRzeA==@Colors"
Expand All @@ -8226,7 +8226,7 @@
"required": []
}
],
"title": "696524a6ff9e8fdff928f109587791e1&Colors"
"title": "425790340007221b61134a9094812da9&Colors"
},
"ZGVjby1zaXRlcy9pbnRpbWlzc2ltaS9zZWN0aW9ucy9EZXNpZ25TeXN0ZW0vRGVzaWduU3lzdGVtLnRzeA==@Miscellaneous": {
"type": "object",
Expand Down Expand Up @@ -8329,7 +8329,7 @@
"type": "object",
"properties": {
"colors": {
"$ref": "#/definitions/ZGVjby1zaXRlcy9pbnRpbWlzc2ltaS9zZWN0aW9ucy9EZXNpZ25TeXN0ZW0vRGVzaWduU3lzdGVtLnRzeA==@696524a6ff9e8fdff928f109587791e1&Colors",
"$ref": "#/definitions/ZGVjby1zaXRlcy9pbnRpbWlzc2ltaS9zZWN0aW9ucy9EZXNpZ25TeXN0ZW0vRGVzaWduU3lzdGVtLnRzeA==@425790340007221b61134a9094812da9&Colors",
"title": "Colors"
},
"miscellaneous": {
Expand Down Expand Up @@ -10990,7 +10990,7 @@
],
"title": "WorkflowRef"
},
"ZGVjby1jeC9saXZlL2FjdGlvbnMvd29ya2Zsb3dzL3N0YXJ0LnRz@334b1e8b1a9b72929b472c12d844039f|WorkflowRef": {
"ZGVjby1jeC9saXZlL2FjdGlvbnMvd29ya2Zsb3dzL3N0YXJ0LnRz@2dc3ea494e366f0c07f2bf4cd27907ef|WorkflowRef": {
"anyOf": [
{
"$ref": "#/definitions/ZGVjby1jeC9saXZlL2FjdGlvbnMvd29ya2Zsb3dzL3N0YXJ0LnRz@WorkflowRef"
Expand All @@ -11008,13 +11008,13 @@
]
}
],
"title": "334b1e8b1a9b72929b472c12d844039f|WorkflowRef"
"title": "2dc3ea494e366f0c07f2bf4cd27907ef|WorkflowRef"
},
"ZGVjby1jeC9saXZlL2FjdGlvbnMvd29ya2Zsb3dzL3N0YXJ0LnRz@Props": {
"type": "object",
"properties": {
"workflow": {
"$ref": "#/definitions/ZGVjby1jeC9saXZlL2FjdGlvbnMvd29ya2Zsb3dzL3N0YXJ0LnRz@334b1e8b1a9b72929b472c12d844039f|WorkflowRef",
"$ref": "#/definitions/ZGVjby1jeC9saXZlL2FjdGlvbnMvd29ya2Zsb3dzL3N0YXJ0LnRz@2dc3ea494e366f0c07f2bf4cd27907ef|WorkflowRef",
"title": "Workflow"
},
"id": {
Expand Down

1 comment on commit 24fb74d

@deno-deploy
Copy link

@deno-deploy deno-deploy bot commented on 24fb74d Jun 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to deploy:

HTTP status server error (500 Internal Server Error) for url (https://denopkg.com/deco-cx/fresh@1.3.0/server.ts)

Please sign in to comment.