Skip to content

Commit

Permalink
hamburguer icon highlights in onboarding tour
Browse files Browse the repository at this point in the history
  • Loading branch information
onmax committed Feb 12, 2022
1 parent 37e26c0 commit 7576332
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/lib/tour/onboarding/06_1_MenuIconStep.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { defaultTooltipModifiers, IWalletHTMLElements } from '..';
import { ITourStep, OnboardingTourStep } from '../types';
import { IOnboardingGetStepFnArgs, ITourStep, OnboardingTourStep } from '../types';
import { getOnboardingTexts } from './OnboardingTourTexts';

export function getMenuIconStep(): ITourStep {
export function getMenuIconStep({ toggleHighlightButton }: IOnboardingGetStepFnArgs): ITourStep {
return {
path: '/',
tooltip: {
Expand Down Expand Up @@ -30,14 +30,17 @@ export function getMenuIconStep(): ITourStep {
},
lifecycle: {
mounted: async ({ goToNextStep }) => {
const hamburguerIconSelector = `${IWalletHTMLElements.ACCOUNT_OVERVIEW_TABLET_MENU_BAR} > button.reset`;
// User is expected to click the hamburguer icon to go to next step
const hamburguerIcon = document.querySelector(
`${IWalletHTMLElements.ACCOUNT_OVERVIEW_TABLET_MENU_BAR} > button.reset`) as HTMLButtonElement;
const hamburguerIcon = document.querySelector(hamburguerIconSelector) as HTMLButtonElement;

const onHamburguerClick = () => goToNextStep();
hamburguerIcon!.addEventListener('click', onHamburguerClick, true);

toggleHighlightButton(hamburguerIconSelector, true, 'gray');

return () => {
toggleHighlightButton(hamburguerIconSelector, false, 'gray');
hamburguerIcon!.removeEventListener('click', onHamburguerClick, true);
};
},
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tour/onboarding/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function getOnboardingTourSteps({ root }: SetupContext, screenTypes: Scre
get [OnboardingTourStep.MENU_ICON]() {
// show only this step if it is a new user and is not in a large screen
return (!screenTypes.isLargeScreen.value && startedFrom === ITourOrigin.WELCOME_MODAL)
? getMenuIconStep() : undefined;
? getMenuIconStep(args) : undefined;
},
[OnboardingTourStep.ACCOUNT_OPTIONS]: getAccountOptionsStep(args),
get [OnboardingTourStep.BACKUP_OPTION_FROM_OPTIONS]() {
Expand Down

0 comments on commit 7576332

Please sign in to comment.