Skip to content

Commit 54e5f8a

Browse files
make button into component, add button to lint page (#1546)
1 parent 7bdf2b8 commit 54e5f8a

File tree

8 files changed

+55
-34
lines changed

8 files changed

+55
-34
lines changed

_components/CTA.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.docs-cta {
2+
@apply border text-balance text-black font-bold inline-block py-3.5 px-6
3+
rounded-full w-max hover:no-underline transition-colors duration-200 mb-6;
4+
}
5+
6+
.runtime-cta,
7+
.deploy-cta {
8+
@apply border-gray-4 hover:!no-underline !text-gray-4;
9+
}
10+
11+
.runtime-cta {
12+
@apply bg-runtime-400 border-runtime-400 hover:bg-runtime-300;
13+
}
14+
15+
.deploy-cta {
16+
@apply bg-deploy-500 border-deploy-500 hover:bg-deploy-400;
17+
}
18+
19+
.jsr-cta {
20+
@apply bg-jsr-yellow-400 border-jsr-cyan-950 !text-jsr-cyan-950 border-2
21+
hover:!no-underline hover:bg-jsr-yellow-300;
22+
}

_components/CTA.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default function CTA(
2+
{ href, children, type }: { href: string; children: string; type: string },
3+
) {
4+
return (
5+
<a href={href} className={`docs-cta ${type}-cta`}>
6+
{children}
7+
</a>
8+
);
9+
}
10+
11+
export const css = "@import './_components/CTA.css';";

runtime/fundamentals/linting_and_formatting.md renamed to runtime/fundamentals/linting_and_formatting.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ building amazing applications.
1717

1818
## Linting
1919

20+
<comp.CTA href="/lint/" type="runtime">Explore all the lint rules</comp.CTA>
21+
2022
Linting is the process of analyzing your code for potential errors, bugs, and
2123
stylistic issues. Deno’s built-in linter,
2224
[`deno lint`](/runtime/reference/cli/linter/), supports recommended set of rules

runtime/fundamentals/standard_library.md renamed to runtime/fundamentals/standard_library.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ application logic rather than "reinventing the wheel" for common tasks. All of
1010
the modules in the Deno Standard Library are audited by the core team and are
1111
guaranteed to work with Deno, ensuring consistency and reliability.
1212

13-
<a href="https://jsr.io/@std" class="docs-cta jsr-cta" aria-label="See all packages on JSR">See
14-
all packages on
15-
<svg class="inline ml-1" viewBox="0 0 13 7" aria-hidden="true" height="20"><path d="M0,2h2v-2h7v1h4v4h-2v2h-7v-1h-4" fill="#083344"></path><g fill="#f7df1e"><path d="M1,3h1v1h1v-3h1v4h-3"></path><path d="M5,1h3v1h-2v1h2v3h-3v-1h2v-1h-2"></path><path d="M9,2h3v2h-1v-1h-1v3h-1"></path></g></svg>
16-
</a>
13+
<comp.CTA href="https://jsr.io/@std" type="jsr">See
14+
all packages on <svg class="inline ml-1" viewBox="0 0 13 7" aria-hidden="true" height="20"><path d="M0,2h2v-2h7v1h4v4h-2v2h-7v-1h-4" fill="#083344"></path><g fill="#f7df1e"><path d="M1,3h1v1h1v-3h1v4h-3"></path><path d="M5,1h3v1h-2v1h2v3h-3v-1h2v-1h-2"></path><path d="M9,2h3v2h-1v-1h-1v3h-1"></path></g></svg></comp.CTA>
1715

1816
Many packages in the Deno Standard Library are also compatible with Node.js,
1917
Cloudflare Workers, and other JavaScript environments. This allows you to write

runtime/reference/deno_namespace_apis.md renamed to runtime/reference/deno_namespace_apis.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The global `Deno` namespace contains APIs that are not web standard, including
1414
APIs for reading from files, opening TCP sockets, serving HTTP, and executing
1515
subprocesses, etc.
1616

17-
<a href="/api/deno/" class="docs-cta runtime-cta">Explore all Deno APIs</a>
17+
<comp.CTA href="/api/deno" type="runtime">Explore all Deno APIs</comp.CTA>
1818

1919
Below we highlight some of the most important Deno APIs to know.
2020

runtime/reference/web_platform_apis.md renamed to runtime/reference/web_platform_apis.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ means if you've ever built for the browser, you're likely already familiar with
1515
Deno, and if you're learning Deno, you're also investing in your knowledge of
1616
the web.
1717

18-
<a href="/api/web/" class="docs-cta runtime-cta">Explore supported Web APIs</a>
18+
<comp.CTA href="/api/web" type="runtime">Explore supported Web APIs</comp.CTA>
1919

2020
Below we'll highlight some of the standard Web APIs that Deno supports.
2121

styleguide/components.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,20 @@ Toggle control for flipping the theme
4646
```
4747
<comp.ThemeToggle />
4848

49+
## CTA
4950

51+
Call to action button with different colors based on their `type` prop
52+
53+
```tsx
54+
<comp.CTA href="https://deno.com" type="runtime">Explore Deno</comp.CTA>
55+
56+
<comp.CTA href="https://deno.com" type="jsr">See all packages on JSR</comp.CTA>
57+
58+
<comp.CTA href="https://deno.com" type="deploy">Get started</comp.CTA>
59+
```
60+
61+
<comp.CTA href="https://deno.com" type="runtime">Explore Deno</comp.CTA><br/>
62+
63+
<comp.CTA href="https://deno.com" type="jsr">See all packages on JSR</comp.CTA><br/>
64+
65+
<comp.CTA href="https://deno.com" type="deploy">Get started</comp.CTA><br/>

styles.css

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -253,34 +253,6 @@ body {
253253
styleset(ss01, ss07, ss08);
254254
}
255255

256-
/* Common styles for all CTAs */
257-
.docs-cta {
258-
@apply border text-balance text-black font-bold inline-block py-3.5 px-4
259-
rounded-full w-max hover:no-underline transition-colors duration-200;
260-
}
261-
262-
/* Specific styles for runtime CTAs */
263-
.runtime-cta {
264-
@apply bg-runtime-400 border-runtime-400 hover:bg-runtime-300;
265-
}
266-
267-
/* Override for when CTA is used in markdown body */
268-
.markdown-body .runtime-cta,
269-
.markdown-body .deploy-cta {
270-
@apply border-gray-4 hover:!no-underline !text-gray-4;
271-
}
272-
273-
/* Specific styles for deploy CTAs */
274-
.deploy-cta {
275-
@apply bg-deploy-500 border-deploy-500 hover:bg-deploy-400;
276-
}
277-
278-
/* Specific styles for JSR CTAs */
279-
.jsr-cta {
280-
@apply bg-jsr-yellow-400 border-jsr-cyan-950 !text-jsr-cyan-950 border-2
281-
hover:!no-underline hover:bg-jsr-yellow-300;
282-
}
283-
284256
.homepage-link {
285257
@apply block font-normal underline underline-offset-4;
286258
}

0 commit comments

Comments
 (0)