Skip to content

Commit ee7a40d

Browse files
author
ganchimeg
committed
query and use svgs located inside each product folder for nav left svg icon
1 parent dcaabff commit ee7a40d

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

gatsby-config.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ products.forEach(name => {
5757
productIcons[name] = require(getProduct(name)).pathD
5858
})
5959

60-
if (docsConfig.productLogoPathD && docsConfig.productIconKey) {
61-
return Error("Set either `productLogoPathD` or `productIconKey` in docs-config.js, not both")
62-
}
63-
6460
if (docsConfig.productIconKey) {
6561
docsConfig.productLogoPathD = productIcons[docsConfig.productIconKey]
6662
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React from "react"
22
import getCloudflareDocsConfig from "../utils/get-cloudflare-docs-config"
3-
import AccessibleSVG from "./accessible-svg"
3+
import getUniqueReadableID from "../utils/get-unique-readable-id"
4+
5+
const titleID = getUniqueReadableID("title")
46

57
export default () => {
6-
const { product, productLogoPathD } = getCloudflareDocsConfig()
8+
const { product, productIconKey, logoSVGContent} = getCloudflareDocsConfig()
79

810
return (
9-
<AccessibleSVG title={`Cloudflare ${product} logo`} viewBox="0 0 48 48">
10-
<path d={productLogoPathD}/>
11-
</AccessibleSVG>
11+
<span id={titleID} title={`Cloudflare ${productIconKey} logo`} dangerouslySetInnerHTML={{__html: logoSVGContent}} />
1212
)
1313
}

src/css/docs/components/docs-nav-logo-lockup.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@
1818
flex-shrink: 0;
1919
}
2020

21+
[theme="light"] .DocsNavLogoLockup--logo {
22+
fill: var(--orange);
23+
}
24+
25+
[theme="dark"] .DocsNavLogoLockup--logo {
26+
fill: var(--orange);
27+
}
28+
29+
2130
.DocsNavLogoLockup--text {
2231
font-size: var(--font-size, 1em);
2332
font-weight: 700;

src/utils/get-cloudflare-docs-config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export default () => {
1919
pathPrefix
2020
product
2121
productLogoPathD
22+
productIconKey
23+
logoSVGContent
2224
contentRepo
2325
contentRepoFolder
2426
externalLinks {

0 commit comments

Comments
 (0)