Skip to content

Commit ecd0235

Browse files
committed
Fix layout issues on mobile screen:
* Move "View Source" button to header when the screen is too narrow and collapse the text; * Allow buttons on the title screen to wrap.
1 parent 272bc1c commit ecd0235

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

src/components/ViewSource/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ export function ViewSource(props: {
1212
const {target} = props;
1313
return (
1414
<Link className={styles.viewSource}
15-
to={target}>
15+
to={target}
16+
title='View source code for the playground page'>
1617
<CodeIcon width={24} height={24} />
17-
View Source
18+
<span className={styles.label}>View Source</span>
1819
</Link>
1920
);
2021
}

src/components/ViewSource/styles.module.css

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
position: absolute;
55
margin-top: 10px;
66
right: 10px;
7-
z-index: 100;
7+
z-index: 200;
88

99
text-decoration: none;
1010
color: var(--ifm-color-emphasis-600);
@@ -21,3 +21,16 @@
2121
color: var(--ifm-color-emphasis-600);
2222
background-color: var(--ifm-color-emphasis-200);
2323
}
24+
25+
@media (width <= 700px) {
26+
.viewSource {
27+
margin-top: 14px;
28+
top: 0px;
29+
}
30+
}
31+
32+
@media (width <= 400px) {
33+
.label {
34+
display: none;
35+
}
36+
}

src/pages/index.module.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
display: flex;
7575
align-items: center;
7676
justify-content: center;
77+
flex-wrap: wrap;
7778
gap: 15px;
7879
margin-top: 40px;
7980
--ifm-button-color: #000;

0 commit comments

Comments
 (0)