Visitar URL original
feat(site): add the shared product and logo menus to every nav by iamdavidhill · Pull Request #62654 · anomalyco/opencode · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/nav-menus/bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[test]
root = "./test"
preload = ["./test/happydom.ts"]
24 changes: 24 additions & 0 deletions packages/nav-menus/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode/nav-menus",
"version": "0.0.0",
"private": true,
"type": "module",
"license": "MIT",
"exports": {
".": "./src/index.ts",
"./nav-menus.css": "./src/nav-menus.css"
},
"scripts": {
"typecheck": "bun check --no-script",
"test": "bun test",
"brand": "bun script/brand.ts"
},
"devDependencies": {
"@happy-dom/global-registrator": "20.0.11",
"@types/bun": "catalog:",
"@typescript/native": "catalog:",
"happy-dom": "20.11.1",
"typescript": "catalog:"
}
}
17 changes: 17 additions & 0 deletions packages/nav-menus/script/brand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Writes src/brand.ts from the site's logo files (services/site/src/asset/brand), so the menu carries
// them inline and works on any host: run `bun script/brand.ts` after the brand files change.
const source = new URL("../../../services/site/src/asset/brand/", import.meta.url)
const files = await Promise.all(
(["transparent", "solid"] as const).flatMap((style) =>
(["logo", "wordmark"] as const).flatMap((kind) =>
(["light", "dark"] as const).map(async (tone) => {
const svg = await Bun.file(new URL(`opencode-${kind}-${style}-${tone}.svg`, source)).text()
return ` "${kind}-${style}-${tone}": ${JSON.stringify(svg.replace(/\n/g, "").trim())},`
}),
),
),
)
await Bun.write(
new URL("../src/brand.ts", import.meta.url),
`// Generated by script/brand.ts from services/site/src/asset/brand. Do not edit.\nexport const brandSvgs: Record<string, string> = {\n${files.join("\n")}\n}\n`,
)
19 changes: 19 additions & 0 deletions packages/nav-menus/src/brand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Generated by script/brand.ts from services/site/src/asset/brand. Do not edit.
export const brandSvgs: Record<string, string> = {
"logo-transparent-light":
'<svg width="240" height="300" viewBox="0 0 240 300" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M180 240H60V120H180V240Z" fill="#1F1F1F" fill-opacity="0.2"/><path d="M180 60H60V240H180V60ZM240 300H0V0H240V300Z" fill="#1F1F1F"/></svg>',
"logo-transparent-dark":
'<svg width="240" height="300" viewBox="0 0 240 300" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M180 240H60V120H180V240Z" fill="#EEEEEE" fill-opacity="0.28"/><path d="M180 60H60V240H180V60ZM240 300H0V0H240V300Z" fill="#EEEEEE"/></svg>',
"wordmark-transparent-light":
'<svg width="640" height="115" viewBox="0 0 640 115" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M49.2346 82.1433H16.4141V49.2861H49.2346V82.1433Z" fill="#1F1F1F" fill-opacity="0.2"/><path d="M49.2308 32.8573H16.4103V82.143H49.2308V32.8573ZM65.641 98.5716H0V16.4287H65.641V98.5716Z" fill="#1F1F1F" fill-opacity="0.7"/><path d="M131.281 82.1433H98.4609V49.2861H131.281V82.1433Z" fill="#1F1F1F" fill-opacity="0.2"/><path d="M98.4649 82.143H131.285V32.8573H98.4649V82.143ZM147.696 98.5716H98.4649V115H82.0547V16.4287H147.696V98.5716Z" fill="#1F1F1F" fill-opacity="0.7"/><path d="M229.746 65.7139V82.1424H180.516V65.7139H229.746Z" fill="#1F1F1F" fill-opacity="0.2"/><path d="M229.743 65.7144H180.512V82.143H229.743V98.5716H164.102V16.4287H229.743V65.7144ZM180.512 49.2859H213.332V32.8573H180.512V49.2859Z" fill="#1F1F1F" fill-opacity="0.7"/><path d="M295.383 98.5718H262.562V49.2861H295.383V98.5718Z" fill="#1F1F1F" fill-opacity="0.2"/><path d="M295.387 32.8573H262.567V98.5716H246.156V16.4287H295.387V32.8573ZM311.797 98.5716H295.387V32.8573H311.797V98.5716Z" fill="#1F1F1F" fill-opacity="0.7"/><path d="M393.848 82.1433H344.617V49.2861H393.848V82.1433Z" fill="#1F1F1F" fill-opacity="0.2"/><path d="M393.844 32.8573H344.613V82.143H393.844V98.5716H328.203V16.4287H393.844V32.8573Z" fill="#1F1F1F"/><path d="M459.485 82.1433H426.664V49.2861H459.485V82.1433Z" fill="#1F1F1F" fill-opacity="0.2"/><path d="M459.489 32.8573H426.668V82.143H459.489V32.8573ZM475.899 98.5716H410.258V16.4287H475.899V98.5716Z" fill="#1F1F1F"/><path d="M541.539 82.1433H508.719V49.2861H541.539V82.1433Z" fill="#1F1F1F" fill-opacity="0.2"/><path d="M541.535 32.8571H508.715V82.1428H541.535V32.8571ZM557.946 98.5714H492.305V16.4286H541.535V0H557.946V98.5714Z" fill="#1F1F1F"/><path d="M639.996 65.7139V82.1424H590.766V65.7139H639.996Z" fill="#1F1F1F" fill-opacity="0.2"/><path d="M590.77 32.8573V49.2859H623.59V32.8573H590.77ZM640 65.7144H590.77V82.143H640V98.5716H574.359V16.4287H640V65.7144Z" fill="#1F1F1F"/></svg>',
"wordmark-transparent-dark":
'<svg width="641" height="115" viewBox="0 0 641 115" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M49.2868 82.1433H16.4297V49.2861H49.2868V82.1433Z" fill="#EEEEEE" fill-opacity="0.28"/><path d="M49.2857 32.8573H16.4286V82.143H49.2857V32.8573ZM65.7143 98.5716H0V16.4287H65.7143V98.5716Z" fill="#EEEEEE" fill-opacity="0.72"/><path d="M131.427 82.1433H98.5703V49.2861H131.427V82.1433Z" fill="#EEEEEE" fill-opacity="0.28"/><path d="M98.5692 82.143H131.426V32.8573H98.5692V82.143ZM147.855 98.5716H98.5692V115H82.1406V16.4287H147.855V98.5716Z" fill="#EEEEEE" fill-opacity="0.72"/><path d="M229.997 65.7139V82.1424H180.711V65.7139H229.997Z" fill="#EEEEEE" fill-opacity="0.28"/><path d="M230.003 65.7144H180.718V82.143H230.003V98.5716H164.289V16.4287H230.003V65.7144ZM180.718 49.2859H213.575V32.8573H180.718V49.2859Z" fill="#EEEEEE" fill-opacity="0.72"/><path d="M295.717 98.5718H262.859V49.2861H295.717V98.5718Z" fill="#EEEEEE" fill-opacity="0.28"/><path d="M295.715 32.8573H262.858V98.5716H246.43V16.4287H295.715V32.8573ZM312.144 98.5716H295.715V32.8573H312.144V98.5716Z" fill="#EEEEEE" fill-opacity="0.72"/><path d="M394.286 82.1433H345V49.2861H394.286V82.1433Z" fill="#EEEEEE" fill-opacity="0.28"/><path d="M394.285 32.8573H344.999V82.143H394.285V98.5716H328.57V16.4287H394.285V32.8573Z" fill="#EEEEEE"/><path d="M459.998 82.1433H427.141V49.2861H459.998V82.1433Z" fill="#EEEEEE" fill-opacity="0.28"/><path d="M459.997 32.8573H427.14V82.143H459.997V32.8573ZM476.425 98.5716H410.711V16.4287H476.425V98.5716Z" fill="#EEEEEE"/><path d="M542.146 82.1433H509.289V49.2861H542.146V82.1433Z" fill="#EEEEEE" fill-opacity="0.28"/><path d="M542.145 32.8571H509.288V82.1429H542.145V32.8571ZM558.574 98.5714H492.859V16.4286H542.145V0H558.574V98.5714Z" fill="#EEEEEE"/><path d="M640.715 65.7139V82.1424H591.43V65.7139H640.715Z" fill="#EEEEEE" fill-opacity="0.28"/><path d="M591.429 32.8573V49.2859H624.286V32.8573H591.429ZM640.714 65.7144H591.429V82.143H640.714V98.5716H575V16.4287H640.714V65.7144Z" fill="#EEEEEE"/></svg>',
"logo-solid-light":
'<svg width="240" height="300" viewBox="0 0 240 300" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M180 60H60V240H180V60ZM240 300H0V0H240V300Z" fill="#1F1F1F"/></svg>',
"logo-solid-dark":
'<svg width="240" height="300" viewBox="0 0 240 300" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M180 60H60V240H180V60ZM240 300H0V0H240V300Z" fill="#EEEEEE"/></svg>',
"wordmark-solid-light":
'<svg width="640" height="115" viewBox="0 0 640 115" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M49.2308 32.8573H16.4103V82.143H49.2308V32.8573ZM65.641 98.5716H0V16.4287H65.641V98.5716ZM98.4649 82.143H131.285V32.8573H98.4649V82.143ZM147.696 98.5716H98.4649V115H82.0547V16.4287H147.696V98.5716ZM229.743 65.7144H180.512V82.143H229.743V98.5716H164.102V16.4287H229.743V65.7144ZM180.512 49.2859H213.332V32.8573H180.512V49.2859ZM295.387 32.8573H262.567V98.5716H246.156V16.4287H295.387V32.8573ZM311.797 98.5716H295.387V32.8573H311.797V98.5716ZM393.844 32.8573H344.613V82.143H393.844V98.5716H328.203V16.4287H393.844V32.8573ZM459.489 32.8573H426.668V82.143H459.489V32.8573ZM475.899 98.5716H410.258V16.4287H475.899V98.5716ZM541.535 32.8571H508.715V82.1428H541.535V32.8571ZM557.946 98.5714H492.305V16.4286H541.535V0H557.946V98.5714ZM590.77 32.8573V49.2859H623.59V32.8573H590.77ZM640 65.7144H590.77V82.143H640V98.5716H574.359V16.4287H640V65.7144Z" fill="#1F1F1F"/></svg>',
"wordmark-solid-dark":
'<svg width="641" height="115" viewBox="0 0 641 115" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M49.2857 32.8573H16.4286V82.143H49.2857V32.8573ZM65.7143 98.5716H0V16.4287H65.7143V98.5716ZM98.5692 82.143H131.426V32.8573H98.5692V82.143ZM147.855 98.5716H98.5692V115H82.1406V16.4287H147.855V98.5716ZM230.003 65.7144H180.718V82.143H230.003V98.5716H164.289V16.4287H230.003V65.7144ZM180.718 49.2859H213.575V32.8573H180.718V49.2859ZM295.715 32.8573H262.858V98.5716H246.43V16.4287H295.715V32.8573ZM312.144 98.5716H295.715V32.8573H312.144V98.5716ZM394.285 32.8573H344.999V82.143H394.285V98.5716H328.57V16.4287H394.285V32.8573ZM459.997 32.8573H427.14V82.143H459.997V32.8573ZM476.425 98.5716H410.711V16.4287H476.425V98.5716ZM542.145 32.8571H509.288V82.1429H542.145V32.8571ZM558.574 98.5714H492.859V16.4286H542.145V0H558.574V98.5714ZM591.429 32.8573V49.2859H624.286V32.8573H591.429ZM640.714 65.7144H591.429V82.143H640.714V98.5716H575V16.4287H640.714V65.7144Z" fill="#EEEEEE"/></svg>',
}
Loading
Loading