tfrere commited on
Commit
a0d0115
·
1 Parent(s): ac2c53b

add tooltip to the searchbar

Browse files
client/src/components/LeaderboardFilters/SearchBar.jsx CHANGED
@@ -1,5 +1,6 @@
1
  import React, { useState } from "react";
2
  import PropTypes from "prop-types";
 
3
  import {
4
  Box,
5
  Stack,
@@ -9,8 +10,11 @@ import {
9
  Divider,
10
  FormControlLabel,
11
  Switch,
 
 
12
  } from "@mui/material";
13
  import SearchIcon from "@mui/icons-material/Search";
 
14
  import { useDebounce } from "../../hooks/useDebounce";
15
 
16
  const SearchBar = ({
@@ -130,10 +134,67 @@ const SearchBar = ({
130
  color: "text.secondary",
131
  fontWeight: 400,
132
  ml: 0.5,
 
133
  }}
134
  >
135
  leaderboards
136
  </Typography>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  </Box>
138
 
139
  <Divider orientation="vertical" flexItem />
 
1
  import React, { useState } from "react";
2
  import PropTypes from "prop-types";
3
+ import { Link } from "react-router-dom";
4
  import {
5
  Box,
6
  Stack,
 
10
  Divider,
11
  FormControlLabel,
12
  Switch,
13
+ Tooltip,
14
+ IconButton,
15
  } from "@mui/material";
16
  import SearchIcon from "@mui/icons-material/Search";
17
+ import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
18
  import { useDebounce } from "../../hooks/useDebounce";
19
 
20
  const SearchBar = ({
 
134
  color: "text.secondary",
135
  fontWeight: 400,
136
  ml: 0.5,
137
+ display: isMobile ? "none" : "block",
138
  }}
139
  >
140
  leaderboards
141
  </Typography>
142
+
143
+ <Tooltip
144
+ title={
145
+ <React.Fragment>
146
+ <Box sx={{ p: 1, pb: 2 }}>
147
+ <Typography
148
+ variant="body2"
149
+ sx={{ fontWeight: 500, mb: 2 }}
150
+ >
151
+ How to use search
152
+ </Typography>
153
+ <ul
154
+ style={{
155
+ margin: 0,
156
+ paddingLeft: "1.5rem",
157
+ }}
158
+ >
159
+ <li>
160
+ <b>Simple search</b>: searches for exact text in
161
+ leaderboard names
162
+ </li>
163
+ <li style={{ marginTop: "1rem" }}>
164
+ <b>Tag search</b>: use tag prefixes followed by a
165
+ value. See all available tags in the{" "}
166
+ <Link
167
+ to="/submit"
168
+ style={{
169
+ color: "#90caf9",
170
+ textDecoration: "none",
171
+ fontWeight: 500,
172
+ }}
173
+ >
174
+ How to submit
175
+ </Link>{" "}
176
+ page.
177
+ </li>
178
+ </ul>
179
+ </Box>
180
+ </React.Fragment>
181
+ }
182
+ arrow
183
+ placement="top"
184
+ sx={{ maxWidth: 350 }}
185
+ >
186
+ <IconButton
187
+ size="small"
188
+ sx={{
189
+ ml: 1.5,
190
+ color: "text.secondary",
191
+ padding: "2px",
192
+ display: isMobile ? "none" : "inline-flex",
193
+ }}
194
+ >
195
+ <InfoOutlinedIcon fontSize="small" />
196
+ </IconButton>
197
+ </Tooltip>
198
  </Box>
199
 
200
  <Divider orientation="vertical" flexItem />