Skip to content

Commit 79814be

Browse files
committed
add new copy to clipboard feature to install section
Signed-off-by: Jess Chitas <[email protected]>
1 parent d77d57f commit 79814be

File tree

4 files changed

+70
-15
lines changed

4 files changed

+70
-15
lines changed

src/App.css

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,30 @@
101101
}
102102

103103
/* ----------------------------- Install Section ---------------------------- */
104+
.copy-button {
105+
align-content: center;
106+
justify-content: center;
107+
background-color: rgba(0, 0, 0, 0);
108+
}
109+
110+
.copy-button:hover {
111+
background-color: #454545;
112+
border-radius: 20%;
113+
transition-duration: 2ms;
114+
}
115+
116+
.copy-svg {
117+
@media screen and (max-width: 768px){
118+
width: 20px;
119+
}
120+
}
104121

105122
.install-info, .demo-info {
106123
padding: 10%;
107124
@media screen and (max-width: 1024px) {
108125
font-size: medium;
109126
@media screen and (max-width: 768px) {
110127
font-size: small;
111-
@media screen and (max-width: 500px) {
112-
font-size: x-small;
113-
}
114128
}
115129
}
116130
}
@@ -121,12 +135,24 @@
121135

122136
.install-code {
123137
/* word-break: break-all; */
138+
display: flex;
139+
justify-content: space-between;
140+
align-items: center;
124141
font-family: "Red Hat Mono", monospace !important;
125142
font-weight: 500;
126143
padding: 1rem;
144+
padding-left: 2rem;
127145
background-color: #262626;
128146
border-radius: 15px;
129147
width: 100%;
148+
@media screen and (max-width: 768px) {
149+
padding: 0.75rem;
150+
padding-left: 1rem;
151+
@media screen and (max-width: 500px) {
152+
padding: 0.5rem;
153+
padding-left: 1rem;;
154+
}
155+
}
130156
}
131157

132158
.install-code div {
@@ -286,7 +312,7 @@ button {
286312
transition: border-color 0.25s;
287313
}
288314

289-
button:not(.install-button) {
315+
button:not(.install-button, .copy-button) {
290316
display: flex;
291317
align-items: center;
292318
width: 70%;

src/App.jsx

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ import aboutGraphic1 from "./assets/ramalama-about-graphic-1.svg";
1414
import aboutGraphic2 from "./assets/ramalama-about-graphic-2.svg";
1515
import aboutGraphic3 from "./assets/ramalama-about-graphic-3.svg";
1616
import aboutGraphic4 from "./assets/ramalama-about-graphic-4.svg";
17+
import copySVG from "./assets/copy.svg";
18+
19+
let installCode1 = "curl -fsSL https://ramalama.ai/install.sh | bash";
20+
let installCode2 = "pip install ramalama";
1721

1822
/* -------------------------------- Main App Function -------------------------------- */
1923
function App() {
@@ -31,7 +35,7 @@ function App() {
3135
<ul>
3236
<li>
3337
<a href="https://github.com/containers/ramalama?tab=readme-ov-file#install">
34-
<button>
38+
<button className="button">
3539
{" "}
3640
<img src={installIcon} alt="Install Icon"></img>{" "}
3741
<p>Installation guide here</p>
@@ -40,7 +44,7 @@ function App() {
4044
</li>
4145
<li>
4246
<a href="https://github.com/containers/ramalama">
43-
<button>
47+
<button className="button">
4448
{" "}
4549
<img src={githubIcon} alt="GitHub Icon"></img>{" "}
4650
<p>Contribute to the project</p>
@@ -49,7 +53,7 @@ function App() {
4953
</li>
5054
<li>
5155
<a href="https://matrix.to/#/#ramalama:fedoraproject.org">
52-
<button>
56+
<button className="button">
5357
{" "}
5458
<img src={communityIcon} alt="Community Icon"></img>{" "}
5559
<p>Interact with the community</p>
@@ -58,7 +62,7 @@ function App() {
5862
</li>
5963
<li>
6064
<a href="https://github.com/containers/ramalama?tab=readme-ov-file#hardware-support">
61-
<button>
65+
<button className="button">
6266
{" "}
6367
<img src={hardwareIcon} alt="Hardware Icon"></img>{" "}
6468
<p>Hardware support here</p>
@@ -85,12 +89,32 @@ function App() {
8589
<h2 className="install-h2">
8690
Install RamaLama by running this in your command line:
8791
</h2>
88-
<h3 className="install-h3">Linux and Mac:</h3>
89-
<p className="install-code">
90-
<div>curl -fsSL https://ramalama.ai/install.sh | sh</div>
91-
</p>
92-
<h3 className="install-h3">RamaLama is also available on PyPi!</h3>
93-
<p className="install-code">pip install ramalama</p>
92+
<div>
93+
<h3 className="install-h3">Linux and Mac:</h3>
94+
<div className="install-code">
95+
<p>{installCode1}</p>
96+
<button
97+
className="copy-button"
98+
onClick={() => navigator.clipboard.writeText(installCode1)}
99+
>
100+
<img className="copy-svg" src={copySVG} width="30px" />
101+
</button>
102+
</div>
103+
</div>
104+
<div>
105+
<h3 className="install-h3">
106+
RamaLama is also available on PyPi!
107+
</h3>
108+
<div className="install-code">
109+
<p>{installCode2}</p>
110+
<button
111+
className="copy-button"
112+
onClick={() => navigator.clipboard.writeText(installCode2)}
113+
>
114+
<img className="copy-svg" src={copySVG} width="30px" />
115+
</button>
116+
</div>
117+
</div>
94118
<a href="https://github.com/containers/ramalama?tab=readme-ov-file#install">
95119
<button className="install-button" role="button">
96120
More install methods here
@@ -103,7 +127,11 @@ function App() {
103127
<div className="demo viewport orange-background">
104128
<div className="demo-info">
105129
<h1 className="demo-header">Watch it in action</h1>
106-
<img src={demoGIF} className="demo-gif" alt="GIF of RamaLama running in a command line"></img>
130+
<img
131+
src={demoGIF}
132+
className="demo-gif"
133+
alt="GIF of RamaLama running in a command line"
134+
></img>
107135
</div>
108136
</div>
109137

src/assets/.DS_Store

0 Bytes
Binary file not shown.

src/assets/copy.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)