Skip to content

Commit 7dfedc4

Browse files
authored
fix: improve responsive preview and make URL clickable in new tab (#93)
* Responsive preview and url is clickable and open to new tab. * fix: responsive preview fixes and clickable URL update
1 parent 790e4ff commit 7dfedc4

File tree

2 files changed

+44
-6
lines changed

2 files changed

+44
-6
lines changed

index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,14 @@ const App = () => {
365365
</div>
366366
<div className="result">
367367
<ImageComponent queryString={queryString} />
368-
<p className="url">
368+
<a
369+
className="url"
370+
href={`https://capsule-render.vercel.app/api?${queryString}`}
371+
target="_blank"
372+
>
369373
https://capsule-render.vercel.app/api?{queryString}
370-
</p>
374+
</a>
375+
371376
<button className="copy-btn" onClick={copyHandler}>
372377
Copy
373378
</button>

style.css

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,62 @@ body {
1717
position: relative;
1818
max-width: 911px;
1919
}
20+
2021
@media (min-width: 1350px) {
2122
.panel {
2223
width: calc(100% - 1000px);
2324
}
2425
}
2526

2627
.result {
27-
min-width: 1000px;
28-
width: 100%;
28+
width: 100vw;
29+
max-width: 911px;
2930
position: relative;
3031
text-align: center;
32+
display: flex;
33+
flex-direction: column;
34+
align-items: center;
35+
justify-content: center;
3136
}
37+
38+
.result img {
39+
max-width: 100%;
40+
}
41+
42+
3243
@media (min-width: 1350px) {
3344
.result {
45+
min-width: 1000px;
3446
width: 1000px;
47+
position: fixed;
48+
right: 0;
49+
top: 10;
50+
height: 100vh;
51+
width: 400px;
52+
overflow-y: auto;
53+
background: #fff;
54+
box-sizing: border-box;
55+
z-index: 999;
56+
display: flex;
57+
flex-direction: column;
58+
justify-content: start;
59+
align-items: center;
3560
}
3661
}
62+
3763
.result .url {
38-
width: 700px;
3964
max-width: 100%;
4065
margin: 20px auto;
4166
background: #eee;
67+
color: blue;
4268
padding: 1rem;
4369
font-size: 16px;
4470
border-radius: 8px;
4571
word-break: break-all;
4672
text-align: left;
73+
cursor: pointer;
4774
}
75+
4876
.result .copy-btn {
4977
border: none;
5078
background: #494949;
@@ -55,6 +83,7 @@ body {
5583
font-weight: bold;
5684
cursor: pointer;
5785
}
86+
5887
.result .copy-btn:hover {
5988
background: #5a5a5a;
6089
}
@@ -72,21 +101,25 @@ body {
72101
flex: 0 0 100%;
73102
margin: 0.75rem 0rem;
74103
}
104+
75105
.group label {
76106
margin-left: 1rem;
77107
}
108+
78109
@media (min-width: 1700px) {
79110
.group {
80111
width: 49%;
81112
flex: 0 0 49%;
82113
}
83114
}
115+
84116
.desc {
85117
margin: 0px;
86118
color: #979797;
87119
font-size: 13px;
88120
margin-left: 1rem;
89121
}
122+
90123
.desc a {
91124
color: #979797;
92125
}
@@ -98,4 +131,4 @@ body {
98131
background: #494949;
99132
color: white;
100133
margin: 0px;
101-
}
134+
}

0 commit comments

Comments
 (0)