-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
687 add onboarding to develop (#694)
* Install react joyride * Fix error and icon display * Add onboarding component * Add onboarding to event page * Add onboarding to results * Update store with onboarding changes * Add onboarding to results page * Add onboarding to cycles page
- Loading branch information
1 parent
cbcd143
commit 2963a25
Showing
10 changed files
with
603 additions
and
103 deletions.
There are no files selected for viewing
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
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,73 @@ | ||
import { CSSProperties, ReactNode } from 'react'; | ||
import Joyride, { CallBackProps } from 'react-joyride'; | ||
import { useAppStore } from '../../store'; | ||
|
||
type OnboardingProps = { | ||
type: 'event' | 'cycle' | 'results'; | ||
steps: { | ||
target: string; | ||
content: ReactNode; | ||
}[]; | ||
}; | ||
|
||
const buttonBase: CSSProperties = { | ||
fontFamily: 'var(--font-family-button)', | ||
fontWeight: '500', | ||
padding: '8px 16px', | ||
textTransform: 'uppercase', | ||
}; | ||
|
||
function Onboarding({ steps, type }: OnboardingProps) { | ||
const { onboardingStatus, setOnboardingStatus } = useAppStore((state) => ({ | ||
onboardingStatus: state.onboardingStatus, | ||
setOnboardingStatus: state.setOnboardingStatus, | ||
})); | ||
|
||
const run = onboardingStatus[type] !== 'COMPLETE'; | ||
|
||
const handleJoyrideCallback = (data: CallBackProps) => { | ||
if (data.status === 'finished' || data.status === 'skipped') { | ||
setOnboardingStatus(type, 'COMPLETE'); | ||
console.log('Onboarding completed for', type); | ||
} | ||
}; | ||
|
||
return ( | ||
<Joyride | ||
steps={steps} | ||
run={run} | ||
continuous | ||
showProgress | ||
showSkipButton | ||
hideCloseButton | ||
callback={handleJoyrideCallback} | ||
styles={{ | ||
buttonBack: { | ||
...buttonBase, | ||
backgroundColor: 'var(--color-white)', | ||
color: 'var(--color-black)', | ||
}, | ||
buttonNext: { | ||
...buttonBase, | ||
backgroundColor: 'var(--color-black)', | ||
color: 'var(--color-white)', | ||
}, | ||
buttonSkip: { | ||
...buttonBase, | ||
backgroundColor: 'var(--color-white)', | ||
color: 'var(--color-black)', | ||
}, | ||
buttonClose: { | ||
color: 'var(--color-black)', | ||
}, | ||
options: { | ||
arrowColor: 'var(--color-white)', | ||
backgroundColor: 'var(--color-white)', | ||
primaryColor: 'var(--color-black)', | ||
}, | ||
}} | ||
/> | ||
); | ||
} | ||
|
||
export default Onboarding; |
9 changes: 9 additions & 0 deletions
9
packages/berlin/src/components/onboarding/Onboaring.styled.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,9 @@ | ||
import styled from 'styled-components'; | ||
import { FlexColumn } from '../containers/FlexColumn.styled'; | ||
|
||
export const OnboardingCard = styled(FlexColumn)` | ||
padding: 0rem; | ||
background-color: var(--color-white); | ||
text-align: left; | ||
gap: 0.75rem; | ||
`; |
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 @@ | ||
export { default } from './Onboarding'; |
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
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
Oops, something went wrong.