MCPcopy Create free account
hub / github.com/OpenSIST/OpenSIST.github.io / PageDots

Function PageDots

src/Components/Home/home.jsx:241–308  ·  view source on GitHub ↗
({pageIndex, setPageIndex})

Source from the content-addressed store, hash-verified

239}
240
241function PageDots({pageIndex, setPageIndex}) {
242 const dark = useTheme().palette.mode === 'dark';
243 const gradient = dark
244 ? 'linear-gradient(140deg, #93C0F2, #6BA6E8)'
245 : 'linear-gradient(140deg, #1C5BAA, #4F86CE)';
246 const ring = dark ? 'rgba(107,166,232,0.20)' : 'rgba(28,91,170,0.16)';
247 const glow = dark ? 'rgba(107,166,232,0.55)' : 'rgba(28,91,170,0.45)';
248 const railGradient = dark
249 ? 'linear-gradient(180deg, transparent, rgba(147,192,242,0.28), transparent)'
250 : 'linear-gradient(180deg, transparent, rgba(28,91,170,0.20), transparent)';
251 const idle = dark ? 'rgba(231,235,241,0.35)' : 'rgba(16,24,40,0.22)';
252 const idleHover = dark ? 'rgba(231,235,241,0.6)' : 'rgba(16,24,40,0.4)';
253
254 return (
255 <Box sx={{
256 position: 'fixed',
257 right: {xs: 14, md: 26},
258 top: '50%',
259 transform: 'translateY(-50%)',
260 display: 'flex',
261 flexDirection: 'column',
262 alignItems: 'center',
263 gap: 1.75,
264 zIndex: 10,
265 '&::before': {
266 content: '""',
267 position: 'absolute',
268 top: 2,
269 bottom: 2,
270 left: '50%',
271 width: 2,
272 transform: 'translateX(-50%)',
273 borderRadius: 2,
274 background: railGradient,
275 zIndex: -1,
276 },
277 }}>
278 {Array.from({length: PAGE_COUNT}).map((_, p) => {
279 const active = pageIndex === p;
280 return (
281 <Box
282 key={p}
283 component="button"
284 type="button"
285 aria-label={`第 ${p + 1} 屏`}
286 aria-current={active ? 'true' : undefined}
287 onClick={() => setPageIndex(p)}
288 sx={{
289 p: 0,
290 border: 'none',
291 appearance: 'none',
292 width: 10,
293 height: 10,
294 borderRadius: '50%',
295 cursor: 'pointer',
296 background: active ? gradient : idle,
297 '&:focus-visible': {outline: '2px solid', outlineColor: 'primary.main', outlineOffset: 3},
298 transform: active ? 'scale(1.6)' : 'scale(1)',

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected