-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1201 from lblod/GN-4854
Convert horizontal alignment menu into icons
- Loading branch information
Showing
3 changed files
with
131 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@lblod/ember-rdfa-editor": minor | ||
--- | ||
|
||
Convert horizontal alignment menu into icons |
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 |
---|---|---|
@@ -1,19 +1,50 @@ | ||
{{! @glint-nocheck: not typesafe yet }} | ||
<Toolbar::Dropdown | ||
@label={{this.labelFor this.currentAlignment}} | ||
@icon={{this.NavDownIcon}} | ||
@iconSize='small' | ||
@controller={{@controller}} | ||
@disabled={{not this.enabled}} | ||
title={{t 'ember-rdfa-editor.alignment.label'}} | ||
as |Menu| | ||
> | ||
{{#each this.options as |option|}} | ||
<Menu.Item | ||
@menuAction={{fn this.setAlignment option}} | ||
title={{this.labelFor option}} | ||
<div class='say-dropdown options'> | ||
<this.Velcro | ||
@placement='bottom' | ||
@offsetOptions={{hash mainAxis=6}} | ||
as |velcro| | ||
> | ||
<button | ||
type='button' | ||
class='say-dropdown__button {{if this.dropdownOpen "is-active" ""}}' | ||
title={{t 'ember-rdfa-editor.alignment.label'}} | ||
disabled={{not this.enabled}} | ||
{{on 'click' this.toggleDropdown}} | ||
{{velcro.hook}} | ||
{{this.setupDropdownButton}} | ||
> | ||
{{this.labelFor option}} | ||
</Menu.Item> | ||
{{/each}} | ||
</Toolbar::Dropdown> | ||
{{this.htmlSafe this.currentAlignIcon}} | ||
<AuIcon @icon={{this.NavDownIcon}} @ariaHidden={{true}} @size='large' /> | ||
</button> | ||
{{#if this.dropdownOpen}} | ||
<div | ||
class='say-dropdown__menu is-visible' | ||
role='menu' | ||
tabindex='-1' | ||
{{velcro.loop}} | ||
{{focus-trap | ||
shouldSelfFocus=true | ||
focusTrapOptions=(hash | ||
clickOutsideDeactivates=this.clickOutsideDropdown | ||
) | ||
}} | ||
> | ||
{{#each this.alignmentStyles as |style|}} | ||
<button | ||
role='menuitem' | ||
type='button' | ||
title={{style.label}} | ||
{{on 'click' (fn this.setAlignment style.value)}} | ||
> | ||
{{#if (this.alignActive style.value)}} | ||
<AuIcon @icon={{this.CheckIcon}} @ariaHidden={{true}} /> | ||
{{/if}} | ||
{{this.htmlSafe style.icon}} | ||
{{style.label}} | ||
</button> | ||
{{/each}} | ||
</div> | ||
{{/if}} | ||
</this.Velcro> | ||
</div> |
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