-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
61 additions
and
47 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
packages/datatrak-web/src/features/WelcomeScreens/CarouselDots.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Tupaia | ||
* Copyright (c) 2017 - 2024 Beyond Essential Systems Pty Ltd | ||
*/ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
justify-content: center; | ||
gap: 0.5rem; | ||
`; | ||
|
||
const Dot = styled.button<{ $active: boolean }>` | ||
width: 0.5rem; | ||
height: 0.5rem; | ||
border-radius: 50%; | ||
background-color: ${({ theme, $active }) => | ||
$active ? theme.palette.primary.main : theme.palette.divider}; | ||
border: none; | ||
cursor: pointer; | ||
padding: 0; | ||
`; | ||
|
||
interface CarouselDotsProps { | ||
maxSteps: number; | ||
activeStep: number; | ||
onClick: (index: number) => void; | ||
} | ||
|
||
export const CarouselDots: React.FC<CarouselDotsProps> = ({ maxSteps, activeStep, onClick }) => { | ||
return ( | ||
<Container> | ||
{Array.from({ length: maxSteps }, (_, i) => ( | ||
<Dot key={i} $active={i === activeStep} onClick={() => onClick(i)} /> | ||
))} | ||
</Container> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters