Skip to content

Commit d6be9c7

Browse files
surya4419teja-pola
authored andcommitted
fix(navbar): improve responsiveness for better user experience (accordproject#174)
* fix(navbar): improve responsiveness for better user experience Signed-off-by: surya4419 <suryaa4419@gmail.com> * fix(navbar): improve responsiveness for better user experience Signed-off-by: surya4419 <suryaa4419@gmail.com> * fix(samples): update TemplateMark, Concerto Model, and Preview Data on selection (accordproject#318) Signed-off-by: surya4419 <suryaa4419@gmail.com> --------- Signed-off-by: surya4419 <suryaa4419@gmail.com> Signed-off-by: Dharma Teja <dteja2468@gmail.com>
1 parent ac6e43a commit d6be9c7

File tree

1 file changed

+78
-12
lines changed

1 file changed

+78
-12
lines changed

src/components/Navbar.tsx

Lines changed: 78 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
InfoOutlined,
1010
BookOutlined,
1111
CaretDownFilled,
12+
MenuOutlined
1213
} from "@ant-design/icons";
1314
import ToggleDarkMode from "./ToggleDarkMode";
1415

@@ -35,6 +36,55 @@ function Navbar({ scrollToFooter }: NavbarProps) {
3536
config: { duration: 1000 },
3637
});
3738

39+
const mobileMenu = (
40+
<Menu>
41+
<Menu.Item key="home">
42+
<Link to="/">
43+
Template Playground
44+
</Link>
45+
</Menu.Item>
46+
<Menu.Item key="explore" onClick={scrollToFooter}>
47+
Explore
48+
</Menu.Item>
49+
<Menu.Item key="about">
50+
<a
51+
href="https://github.com/accordproject/template-playground/blob/main/README.md"
52+
target="_blank"
53+
rel="noopener noreferrer"
54+
>
55+
<QuestionOutlined /> About
56+
</a>
57+
</Menu.Item>
58+
<Menu.Item key="community">
59+
<a
60+
href="https://discord.com/invite/Zm99SKhhtA"
61+
target="_blank"
62+
rel="noopener noreferrer"
63+
>
64+
<UserOutlined /> Community
65+
</a>
66+
</Menu.Item>
67+
<Menu.Item key="issues">
68+
<a
69+
href="https://github.com/accordproject/template-playground/issues"
70+
target="_blank"
71+
rel="noopener noreferrer"
72+
>
73+
<InfoOutlined /> Issues
74+
</a>
75+
</Menu.Item>
76+
<Menu.Item key="documentation">
77+
<a
78+
href="https://github.com/accordproject/template-engine/blob/main/README.md"
79+
target="_blank"
80+
rel="noopener noreferrer"
81+
>
82+
<BookOutlined /> Documentation
83+
</a>
84+
</Menu.Item>
85+
</Menu>
86+
);
87+
3888
const helpMenu = (
3989
<Menu>
4090
<Menu.ItemGroup key="info" title="Info">
@@ -101,8 +151,8 @@ function Navbar({ scrollToFooter }: NavbarProps) {
101151
lineHeight: "65px",
102152
display: "flex",
103153
alignItems: "center",
104-
paddingLeft: screens.md ? 40 : 10,
105-
paddingRight: screens.md ? 40 : 10,
154+
paddingLeft: screens.lg ? 40 : screens.md ? 10 : 10,
155+
paddingRight: screens.lg ? 40 : screens.md ? 10 : 10,
106156
}}
107157
>
108158
<div
@@ -123,16 +173,16 @@ function Navbar({ scrollToFooter }: NavbarProps) {
123173
alt="Template Playground"
124174
preview={false}
125175
style={{
126-
paddingRight: screens.md ? "24px" : "10px",
176+
paddingRight: screens.md ? "8px" : "2px",
127177
height: "26px",
128178
maxWidth: screens.md ? "184.17px" : "36.67px",
129179
}}
130180
/>
131-
<span style={{ color: "white", whiteSpace: "nowrap" }}>Template Playground</span>
181+
<span style={{ color: "white", display: screens.lg ? "block" : "none" }}>Template Playground</span>
132182

133183
</Link>
134184
</div>
135-
{screens.md && (
185+
{screens.md ? (
136186
<>
137187
<div
138188
style={{
@@ -172,27 +222,43 @@ function Navbar({ scrollToFooter }: NavbarProps) {
172222
</Dropdown>
173223
</div>
174224
</>
225+
) : (
226+
<div style={{ marginLeft: "5px" }}>
227+
<Dropdown overlay={mobileMenu} trigger={["click"]}>
228+
<Button
229+
style={{
230+
background: "transparent",
231+
border: "none",
232+
color: "white",
233+
height: "65px",
234+
display: "flex",
235+
alignItems: "center",
236+
}}
237+
>
238+
<MenuOutlined style={{ fontSize: "20px" }} />
239+
</Button>
240+
</Dropdown>
241+
</div>
175242
)}
176243
<div
177244
style={{
178245
display: "flex",
179246
marginLeft: "auto",
180247
alignItems: "center",
181248
height: "65px",
249+
gap: screens.md ? "20px" : "10px",
250+
marginRight: screens.md ? 0 : "5px"
182251
}}
183252
>
184-
<div>
253+
<div style={{ marginLeft: screens.md ? 0 : "auto" }}>
185254
<ToggleDarkMode />
186255
</div>
187256
{!isLearnPage && (
188257
<div
189258
style={{
190-
marginLeft: screens.md ? "20px" : "0",
191259
height: "65px",
192260
display: "flex",
193261
justifyContent: "center",
194-
paddingLeft: "15px",
195-
borderRadius: "5px",
196262
alignItems: "center",
197263
backgroundColor:
198264
hovered === "join" ? "rgba(255, 255, 255, 0.1)" : "transparent",
@@ -210,7 +276,6 @@ function Navbar({ scrollToFooter }: NavbarProps) {
210276
color: "#050c40",
211277
border: "none",
212278
borderRadius: "5px",
213-
marginRight: "15px",
214279
cursor: "pointer",
215280
}}
216281
>
@@ -230,7 +295,8 @@ function Navbar({ scrollToFooter }: NavbarProps) {
230295
borderLeft: screens.md
231296
? "1.5px solid rgba(255, 255, 255, 0.1)"
232297
: "none",
233-
paddingLeft: screens.md ? "20px" : "0",
298+
paddingLeft: screens.md ? 16 : 5,
299+
paddingRight: screens.md ? 16 : 5,
234300
backgroundColor:
235301
hovered === "github" ? "rgba(255, 255, 255, 0.1)" : "transparent",
236302
cursor: "pointer",
@@ -251,7 +317,7 @@ function Navbar({ scrollToFooter }: NavbarProps) {
251317
marginRight: screens.md ? "5px" : "0",
252318
}}
253319
/>
254-
{screens.md && <span>Github</span>}
320+
<span style={{ display: screens.md ? "inline" : "none" }}>Github</span>
255321
</a>
256322
</div>
257323
</div>

0 commit comments

Comments
 (0)