File tree Expand file tree Collapse file tree 5 files changed +942
-18
lines changed
docs/style-guide/components Expand file tree Collapse file tree 5 files changed +942
-18
lines changed Original file line number Diff line number Diff line change 11---
22import { Code } from " @astrojs/starlight/components" ;
3- import Routes from " ~/content/dash-routes/index.json" ;
3+ import AnchorHeading from " ./AnchorHeading.astro" ;
4+ import CoreRoutes from " ~/content/dash-routes/core.json" ;
5+ import ZeroTrustRoutes from " ~/content/dash-routes/zero-trust.json" ;
46---
57
6- <ul >
7- {
8- Routes .map ((route ) => (
9- <li >
10- <strong >{ (route .parent ?? []).concat (route .name ).join (" > " )} </strong >
11- <br />
12- <Code lang = " mdx" code = { ` <DashButton url="${route .deeplink }" /> ` } />
13- </li >
14- ))
15- }
16- </ul >
8+ <div >
9+ <AnchorHeading depth ={ 3 } title =" Core Routes" />
10+ <ul >
11+ {
12+ CoreRoutes .map ((route ) => (
13+ <li >
14+ <strong >{ (route .parent ?? []).concat (route .name ).join (" > " )} </strong >
15+ <br />
16+ <Code lang = " mdx" code = { ` <DashButton url="${route .deeplink }" /> ` } />
17+ </li >
18+ ))
19+ }
20+ </ul >
21+
22+ <AnchorHeading depth ={ 3 } title =" Zero Trust Routes" />
23+ <ul >
24+ {
25+ ZeroTrustRoutes .map ((route ) => (
26+ <li >
27+ <strong >{ route .name } </strong >
28+ <br />
29+ <Code lang = " mdx" code = { ` <DashButton url="${route .deeplink }" /> ` } />
30+ </li >
31+ ))
32+ }
33+ </ul >
34+ </div >
Original file line number Diff line number Diff line change 11---
22import { z } from " astro:schema" ;
33import { LinkButton } from " @astrojs/starlight/components" ;
4- import Routes from " ~/content/dash-routes/index.json" ;
4+ import CoreRoutes from " ~/content/dash-routes/core.json" ;
5+ import ZeroTrustRoutes from " ~/content/dash-routes/zero-trust.json" ;
56
67const props = z
78 .object ({
89 url: z .string (),
10+ zeroTrust: z .boolean ().optional ().default (false ),
11+ buttonName: z .string ().optional (),
912 })
1013 .strict ();
1114
12- const { url } = props .parse (Astro .props );
15+ const { url, zeroTrust, buttonName } = props .parse (Astro .props );
1316
14- const route = Routes .find ((route ) => route .deeplink === url );
17+ const routes = zeroTrust ? ZeroTrustRoutes : CoreRoutes ;
18+
19+ const route = routes .find ((route ) => route .deeplink === url );
1520
1621if (! route ) {
1722 throw new Error (` [DashButton] No route found for ${url } ` );
1823}
1924
20- const { name } = route ;
25+ const name = buttonName ?? route .name ;
26+ const baseUrl = zeroTrust
27+ ? " https://one.dash.cloudflare.com"
28+ : " https://dash.cloudflare.com" ;
2129
22- const { href } = new URL (route .deeplink , " https://dash.cloudflare.com " );
30+ let { href } = new URL (route .deeplink , baseUrl );
2331---
2432
2533<LinkButton href ={ href } icon =" external" target =" _blank"
File renamed without changes.
You can’t perform that action at this time.
0 commit comments