Skip to content

Commit 6c39d4f

Browse files
KianNHRebeccaTamachiro
authored andcommitted
[Docs Site] Refactor header styling (#20962)
* [Docs Site] Refactor header styling * margin
1 parent 9012b1c commit 6c39d4f

File tree

3 files changed

+48
-22
lines changed

3 files changed

+48
-22
lines changed

src/components/HeaderDropdowns.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ import {
1010
import { useState } from "react";
1111
import { PiCaretDownBold } from "react-icons/pi";
1212

13+
const links = [
14+
{ label: "Docs Directory", href: "/products/" },
15+
{
16+
label: "APIs",
17+
href: "https://developers.cloudflare.com/api/",
18+
},
19+
{ label: "SDKs", href: "/fundamentals/api/reference/sdks/" },
20+
];
21+
1322
const dropdowns = Object.entries({
14-
"API & SDKs": [
15-
{
16-
label: "API documentation",
17-
href: "https://developers.cloudflare.com/api/",
18-
},
19-
{ label: "SDKs", href: "/fundamentals/api/reference/sdks/" },
20-
],
2123
Help: [
2224
{ label: "Help center", href: "https://support.cloudflare.com/" },
2325
{ label: "Cloudflare status", href: "https://www.cloudflarestatus.com/" },
@@ -81,12 +83,15 @@ function Dropdown({ dropdown }: { dropdown: (typeof dropdowns)[number] }) {
8183
export default function HeaderDropdownsComponent() {
8284
return (
8385
<div className="flex gap-2 text-nowrap leading-6">
84-
<a
85-
href="/products/"
86-
className="flex items-center justify-center rounded p-2 font-medium text-black no-underline hover:bg-cl1-white hover:shadow-md dark:hover:bg-cl1-gray-0"
87-
>
88-
Docs Directory
89-
</a>
86+
{links.map(({ label, href }) => (
87+
<a
88+
key={href}
89+
href={href}
90+
className="flex items-center justify-center rounded p-2 font-medium text-black no-underline hover:bg-cl1-white hover:shadow-md dark:hover:bg-cl1-gray-0"
91+
>
92+
{label}
93+
</a>
94+
))}
9095
{dropdowns.map((dropdown) => (
9196
<Dropdown key={dropdown[0]} dropdown={dropdown} />
9297
))}

src/components/overrides/Footer.astro

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
---
22
import Default from "@astrojs/starlight/components/Footer.astro";
3+
import { Icon } from "@astrojs/starlight/components";
4+
import type { StarlightIcon } from "@astrojs/starlight/types";
5+
36
import OneTrust from "../OneTrust.astro";
47
import FeedbackPrompt from "../FeedbackPrompt.tsx";
58
@@ -38,6 +41,24 @@ const groups = Object.entries({
3841
{ text: "RPKI Toolkit", href: "https://rpki.cloudflare.com/" },
3942
{ text: "Certificate Transparency", href: "https://ct.cloudflare.com/" },
4043
],
44+
Community: [
45+
{ text: "X", href: "https://x.com/cloudflare", icon: "x.com" },
46+
{
47+
text: "Discord",
48+
href: "http://discord.cloudflare.com/",
49+
icon: "discord",
50+
},
51+
{
52+
text: "YouTube",
53+
href: "https://www.youtube.com/cloudflare",
54+
icon: "youtube",
55+
},
56+
{
57+
text: "GitHub",
58+
href: "https://github.com/cloudflare/cloudflare-docs",
59+
icon: "github",
60+
},
61+
],
4162
});
4263
4364
const links = Object.entries({
@@ -69,7 +90,7 @@ if (
6990
}
7091
{!splash && <Default />}
7192
<div class="w-full">
72-
<div class="grid grid-cols-2 gap-8 pb-10 pt-6 md:grid-cols-4">
93+
<div class="grid grid-cols-2 gap-8 pb-10 pt-6 lg:grid-cols-5">
7394
{
7495
groups.map(([title, items]) => (
7596
<ul class="flex w-full list-none flex-col gap-3 pl-0">
@@ -78,7 +99,11 @@ if (
7899
</li>
79100
{items.map((link) => (
80101
<li class="text-sm">
81-
<a href={link.href} class="!text-black no-underline">
102+
<a
103+
href={link.href}
104+
class="flex items-center gap-2 !text-black no-underline"
105+
>
106+
{"icon" in link && <Icon name={link.icon as StarlightIcon} />}
82107
{link.text}
83108
</a>
84109
</li>

src/components/overrides/Header.astro

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import LanguageSelect from "@astrojs/starlight/components/LanguageSelect.astro";
33
import DocSearch from "@astrojs/starlight-docsearch/DocSearch.astro";
44
import SiteTitle from "@astrojs/starlight/components/SiteTitle.astro";
5-
import SocialIcons from "@astrojs/starlight/components/SocialIcons.astro";
65
import ThemeSelect from "@astrojs/starlight/components/ThemeSelect.astro";
76
87
import HeaderDropdowns from "../HeaderDropdowns.tsx";
@@ -14,18 +13,15 @@ import HeaderDropdowns from "../HeaderDropdowns.tsx";
1413
<div id="docsearch">
1514
<DocSearch />
1615
</div>
17-
<div id="right-group" class="hidden h-10 flex-wrap gap-x-8 overflow-hidden">
16+
<div id="right-group" class="hidden h-10 flex-wrap gap-x-2 overflow-hidden">
1817
<HeaderDropdowns client:idle />
1918
<a
2019
id="header-login-button"
2120
href="https://dash.cloudflare.com/"
22-
class="flex items-center justify-center rounded bg-cl1-brand-orange px-6 font-medium text-cl1-black no-underline"
21+
class="mr-2 flex items-center justify-center rounded bg-cl1-brand-orange px-6 font-medium text-cl1-black no-underline"
2322
>
24-
Sign up / Log in
23+
Log in
2524
</a>
26-
<div id="social-icons" class="flex items-center gap-4">
27-
<SocialIcons />
28-
</div>
2925
<ThemeSelect />
3026
<LanguageSelect />
3127
</div>

0 commit comments

Comments
 (0)