Skip to content

Commit b610021

Browse files
Merge pull request #91 from parthivsaikia/feat/73-better-instructions
feat: replace instruction modal with persistent keyboard shortcuts
2 parents 86e49f1 + 292499c commit b610021

File tree

1 file changed

+42
-28
lines changed

1 file changed

+42
-28
lines changed

site/src/pages/index.js

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Kbd = styled.kbd`
1717
border-radius: 3px;
1818
box-shadow: inset 0 -1px 0
1919
${({ theme }) => (theme.mode === "light" ? "#c6cbd1" : "#444")};
20-
color: ${({ theme }) => (theme.mode === "light" ? "#444" : "#e6e6e6")};
20+
color: ${({ theme }) => (theme.mode === "light" ? "#333" : "#fff")}; /* Increased contrast for keys */
2121
display: inline-block;
2222
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
2323
font-size: 11px;
@@ -31,19 +31,29 @@ const Kbd = styled.kbd`
3131
const InstructionsContainer = styled.div`
3232
display: flex;
3333
justify-content: center;
34-
align-items: center;
3534
flex-wrap: wrap;
36-
gap: 24px;
37-
margin-top: 16px;
38-
font-size: 0.9rem;
39-
color: ${({ theme }) => (theme.mode === "light" ? "#666" : "#aaa")};
35+
gap: 20px 40px;
36+
margin-top: 8px;
37+
width: 100%;
38+
39+
/* UPDATED: High contrast colors */
40+
color: ${({ theme }) => (theme.mode === "light" ? "#111" : "#fff")};
4041
4142
span {
4243
display: flex;
4344
align-items: center;
45+
white-space: nowrap;
4446
}
4547
`;
4648

49+
const SectionLabel = styled.h3`
50+
font-size: 2rem;
51+
font-weight: 500;
52+
color: ${({ theme }) => (theme.mode === "light" ? "#111" : "#fff")}; /* Matched header contrast */
53+
margin: 0 0 8px 0;
54+
text-align: center;
55+
`;
56+
4757
const IndexPage = () => {
4858
const [theme, toggleTheme] = useDarkMode();
4959
const themeMode = theme === "light" ? lightTheme : darkTheme;
@@ -68,30 +78,34 @@ const IndexPage = () => {
6878
>
6979
<h1>Shape Builder</h1>
7080

71-
<p className="desc-text" style={{ margin: 0 }}>
72-
Click on the grid to start creating a polygon. Each click adds a
73-
point.
74-
</p>
75-
76-
<InstructionsContainer theme={activeTheme}>
77-
<span>
78-
<Kbd theme={activeTheme}>ENTER</Kbd> /{" "}
79-
<Kbd theme={activeTheme}>ESC</Kbd> Close shape
80-
</span>
81+
{/* Instructions Section */}
82+
<div style={{ textAlign: "center" }}>
83+
<SectionLabel theme={activeTheme}>Instructions</SectionLabel>
84+
<p className="desc-text" style={{ margin: 0 }}>
85+
Click on the grid to start creating a polygon. Each click adds a
86+
point.
87+
</p>
88+
</div>
8189

82-
<span>
83-
<Kbd theme={activeTheme}>CTRL</Kbd> Snap to grid
84-
</span>
90+
{/* Key Strokes Section */}
91+
<div style={{ textAlign: "center", marginTop: "2rem", width: "100%" }}>
92+
<SectionLabel theme={activeTheme}>Controls</SectionLabel>
93+
<InstructionsContainer theme={activeTheme}>
94+
<span>
95+
<Kbd theme={activeTheme}>ENTER</Kbd> /{" "}
96+
<Kbd theme={activeTheme}>ESC</Kbd> Close shape
97+
</span>
8598

86-
<span>
87-
<Kbd theme={activeTheme}>CTRL</Kbd> +{" "}
88-
<Kbd theme={activeTheme}>Z</Kbd> Undo
89-
</span>
99+
<span>
100+
<Kbd theme={activeTheme}>CTRL</Kbd> Snap to grid
101+
</span>
90102

91-
<span>
92-
<Kbd theme={activeTheme}>Maximize</Kbd> Visibility
93-
</span>
94-
</InstructionsContainer>
103+
<span>
104+
<Kbd theme={activeTheme}>CTRL</Kbd> +{" "}
105+
<Kbd theme={activeTheme}>Z</Kbd> Undo
106+
</span>
107+
</InstructionsContainer>
108+
</div>
95109
</Box>
96110
</section>
97111

@@ -105,4 +119,4 @@ const IndexPage = () => {
105119

106120
export default IndexPage;
107121

108-
export const Head = () => <title>Meshery – Shape Builder</title>;
122+
export const Head = () => <title>Meshery – Shape Builder</title>;

0 commit comments

Comments
 (0)