Skip to content

Commit 3226bbf

Browse files
DC-6234 Getting Started Page Updates (#7254)
* arrow added * quickstart card hover * always copy button added * hover effect on copy button * spcaer added * pointless css removed * updaets * fuctional * revewrt * fixed for mobile
1 parent e25a5a7 commit 3226bbf

File tree

6 files changed

+67
-8
lines changed

6 files changed

+67
-8
lines changed

content/100-getting-started/index.mdx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import {
2222
SignalStream,
2323
PrismaPostgres,
2424
SquareLogo,
25-
QuickstartLinkCard
25+
QuickstartLinkCard,
26+
Spacer
2627
} from '@site/src/components/GettingStarted';
2728

2829

@@ -34,7 +35,7 @@ import {
3435

3536
[**Prisma ORM**](/orm/overview/introduction/what-is-prisma) is an open-source ORM that provides fast, type-safe access to Postgres, MySQL, SQLite, and more databases, and runs smoothly across Node.js, Bun, and Deno.
3637

37-
```terminal
38+
```terminal always-copy
3839
npx prisma init --db
3940
```
4041
</BorderBox >
@@ -44,7 +45,7 @@ npx prisma init --db
4445

4546
[**Prisma Postgres**](/postgres) is a fully managed PostgreSQL database that scales to zero, integrates with Prisma ORM and Prisma Studio, and includes a generous free tier.
4647

47-
```terminal
48+
```terminal always-copy
4849
npx create-db
4950
```
5051
</BorderBox >
@@ -54,7 +55,7 @@ npx create-db
5455
<br/>
5556

5657
<QuickstartLinkCard
57-
title="Quickstart"
58+
title="Quickstart"
5859
highlight="#16A394"
5960
link="/getting-started/quickstart-prismaPostgres"
6061
>
@@ -180,3 +181,4 @@ Working with **Next.js**, **Remix**, or another framework? You can easily add Pr
180181
/>
181182
</List>
182183

184+
<Spacer size="120px" />

src/components/GettingStarted/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,16 @@ export const QuickstartLinkCard = ({ icon, title, desc, link, highlight, childre
159159
<Link
160160
to={link}
161161
ref={linkCardRef}
162-
className={clsx(styles.linkCardWrapper, highlight && styles.linkCardHighlight)}
162+
className={clsx(
163+
styles.linkCardWrapper,
164+
highlight && styles.linkCardHighlight,
165+
styles.quickstartCard
166+
)}
163167
>
164168
<div className={styles.title}>
165169
{icon && <Icon icon={icon} btn="left" size="18px" />}
166170
<h2>{title}</h2>
171+
<Icon icon="fa-regular fa-arrow-right" size="18px" />
167172
</div>
168173
{children ?? <p>{desc}</p>}
169174
</Link>
@@ -210,3 +215,5 @@ export const List = ({ children, framed, split, ...props }) => (
210215
{children}
211216
</div>
212217
);
218+
219+
export const Spacer = ({ size }: { size: string }) => <div style={{ height: size }} />;

src/css/gettingStarted.module.scss

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@
5858
}
5959
}
6060
}
61+
62+
// Copy button styles specific to Getting Started page
63+
:global(.theme-code-block) {
64+
button[class*="copyButton"] {
65+
background: var(--border-primary, #2d3748);
66+
color: var(--Text-text-secondary, #e2e8f0);
67+
transition: background 0.2s ease;
68+
border: none;
69+
margin-top: 4px;
70+
&:hover {
71+
background: var(--Text-text-disabled, #4a5568);
72+
}
73+
}
74+
}
6175
}
6276

6377
.boxTitle {
@@ -89,8 +103,27 @@
89103
border: 1px solid var(--surface-brand-default);
90104
background: var(--surface-brand-light);
91105
}
106+
&.quickstartCard {
107+
transition:
108+
border 0.2s ease,
109+
background-color 0.2s ease;
110+
&:hover {
111+
border: 1px solid var(--border-color-active, #154f47);
112+
}
113+
.title {
114+
gap: 8px;
115+
i:last-child {
116+
transition: transform 0.2s ease;
117+
}
118+
}
119+
&:hover .title i:last-child {
120+
transform: translateX(8px);
121+
}
122+
}
92123
.title {
93124
display: inline-flex;
125+
align-items: center;
126+
gap: 8px;
94127
h2 {
95128
font-family: Barlow;
96129
border-bottom: 1px solid var(--main-font-color);
@@ -157,6 +190,10 @@
157190
display: flex;
158191
justify-content: flex-start;
159192

193+
@media (max-width: 1400px) {
194+
flex-wrap: wrap;
195+
}
196+
160197
&:not(.framedList) {
161198
@media (min-width: 1400px) {
162199
grid-template-columns: repeat(7, auto);

src/theme/CodeBlock/Content/String.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ export default function CodeBlockString({
9797
/>
9898
)}
9999
{!metastring?.includes("no-copy") && (
100-
<CopyButton className={styles.codeButton} code={code} />
100+
<CopyButton
101+
className={styles.codeButton}
102+
code={code}
103+
alwaysVisible={metastring?.includes("always-copy")}
104+
/>
101105
)}
102106
</div>
103107
</div>

src/theme/CodeBlock/CopyButton/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { translate } from "@docusaurus/Translate";
55
import IconCopy from "@theme/Icon/Copy";
66
import IconSuccess from "@theme/Icon/Success";
77
import styles from "./styles.module.css";
8-
export default function CopyButton({ code, className }) {
8+
export default function CopyButton({ code, className, alwaysVisible = false }) {
99
const [isCopied, setIsCopied] = useState(false);
1010
const copyTimeout = useRef(undefined);
1111
const handleCopyCode = useCallback(() => {
@@ -41,7 +41,8 @@ export default function CopyButton({ code, className }) {
4141
"clean-btn",
4242
className,
4343
styles.copyButton,
44-
isCopied && styles.copyButtonCopied
44+
isCopied && styles.copyButtonCopied,
45+
alwaysVisible && styles.copyButtonAlwaysVisible
4546
)}
4647
onClick={handleCopyCode}
4748
>

src/theme/CodeBlock/CopyButton/styles.module.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
opacity: 1 !important;
33
}
44

5+
.copyButtonAlwaysVisible {
6+
opacity: 0.5 !important;
7+
transition: opacity 0.2s ease;
8+
&:hover {
9+
opacity: 1 !important;
10+
}
11+
}
12+
513
.copyButtonIcons {
614
position: relative;
715
width: 1.125rem;

0 commit comments

Comments
 (0)