Skip to content

Commit

Permalink
Wrap menu dialog and menu into one div
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-grace committed Dec 20, 2023
1 parent c795c3d commit c6baffd
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 59 deletions.
76 changes: 39 additions & 37 deletions src/components/control-bar/control-bar-items/HelpMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,41 +45,43 @@
};
</script>

<AboutDialog
isOpen={isAboutDialogOpen}
onClose={() => {
isAboutDialogOpen = false;
}} />
<div class="relative inline-block">
<button
use:menu.button
on:select={onSelect}
class="inline-flex rounded-full text-xl p-2">
<HelpIcon />
</button>
<MenuTransition show={$menu.expanded}>
<MenuItems {menu}>
<div class="py-2">
<MenuItem {menu} value="help-and-support">
<ExternalLinkIcon />
{$t('helpMenu.helpAndSupport')}
</MenuItem>
</div>
<div class="py-2">
<MenuItem {menu} value="terms-of-use">
<ExternalLinkIcon />
{$t('helpMenu.termsOfUse')}
</MenuItem>
<MenuItem {menu} value="cookies">
<CookiesIcon />
{$t('helpMenu.cookies')}
</MenuItem>
</div>
<div class="py-2">
<MenuItem {menu} value="about">
<InfoIcon />
{$t('helpMenu.about')}
</MenuItem>
</div>
</MenuItems></MenuTransition>
<div>
<AboutDialog
isOpen={isAboutDialogOpen}
onClose={() => {
isAboutDialogOpen = false;
}} />
<div class="relative inline-block">
<button
use:menu.button
on:select={onSelect}
class="inline-flex rounded-full text-xl p-2">
<HelpIcon />
</button>
<MenuTransition show={$menu.expanded}>
<MenuItems {menu}>
<div class="py-2">
<MenuItem {menu} value="help-and-support">
<ExternalLinkIcon />
{$t('helpMenu.helpAndSupport')}
</MenuItem>
</div>
<div class="py-2">
<MenuItem {menu} value="terms-of-use">
<ExternalLinkIcon />
{$t('helpMenu.termsOfUse')}
</MenuItem>
<MenuItem {menu} value="cookies">
<CookiesIcon />
{$t('helpMenu.cookies')}
</MenuItem>
</div>
<div class="py-2">
<MenuItem {menu} value="about">
<InfoIcon />
{$t('helpMenu.about')}
</MenuItem>
</div>
</MenuItems></MenuTransition>
</div>
</div>
46 changes: 24 additions & 22 deletions src/components/control-bar/control-bar-items/SettingsMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,28 @@
};
</script>

<LanguageDialog
isOpen={isLanguageDialogOpen}
onClose={() => {
isLanguageDialogOpen = false;
}} />
<div class="relative inline-block">
<button
use:menu.button
on:select={onSelect}
class="inline-flex rounded-full text-xl p-2">
<SettingsIcon />
</button>
<MenuTransition show={$menu.expanded}>
<MenuItems {menu}>
<div class="py-2">
<MenuItem {menu} value="settings">
<GlobeIcon />
{$t('languageDialog.title')}
</MenuItem>
</div>
</MenuItems>
</MenuTransition>
<div>
<LanguageDialog
isOpen={isLanguageDialogOpen}
onClose={() => {
isLanguageDialogOpen = false;
}} />
<div class="relative inline-block">
<button
use:menu.button
on:select={onSelect}
class="inline-flex rounded-full text-xl p-2">
<SettingsIcon />
</button>
<MenuTransition show={$menu.expanded}>
<MenuItems {menu}>
<div class="py-2">
<MenuItem {menu} value="settings">
<GlobeIcon />
{$t('languageDialog.title')}
</MenuItem>
</div>
</MenuItems>
</MenuTransition>
</div>
</div>

0 comments on commit c6baffd

Please sign in to comment.