Skip to content

Commit

Permalink
refactor(overflow-menu): convert item to flex item
Browse files Browse the repository at this point in the history
  • Loading branch information
emyarod committed Mar 12, 2019
1 parent a6546bf commit 1c8fc74
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
12 changes: 8 additions & 4 deletions src/components/overflow-menu/_overflow-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -319,16 +319,14 @@
width: 100%;
height: 100%;
border: none;
display: inline-block;
display: inline-flex;
align-items: center;
background-color: transparent;
text-align: left;
padding: 0 $spacing-md;
cursor: pointer;
color: $text-02;
max-width: 11.25rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
transition: outline $transition--base, background-color $transition--base, color $transition--base;

&:hover {
Expand All @@ -344,6 +342,12 @@
}
}

.#{$prefix}--overflow-menu-options__option-content {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.#{$prefix}--overflow-menu-options__option:hover {
background-color: $hover-ui;
}
Expand Down
31 changes: 26 additions & 5 deletions src/components/overflow-menu/overflow-menu.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,27 @@
{{/if}}
<ul class="{{@root.prefix}}--overflow-menu-options" tabindex="-1" role="menu" aria-label="Overflow"
data-floating-menu-direction="{{direction}}">
<li
class="{{@root.prefix}}--overflow-menu-options__option {{#if disabled}} {{@root.prefix}}--overflow-menu-options__option--disabled {{/if}} {{#if danger}} {{@root.prefix}}--overflow-menu-options__option--danger {{/if}}"
role="presentation" {{#if disabled}} aria-disabled="true" {{/if}}>
<button class="{{@root.prefix}}--overflow-menu-options__btn" role="menuitem" {{#if title}} title="{{title}}"
{{/if}} {{#if primaryFocus}} data-floating-menu-primary-focus {{/if}} {{#if disabled}} tabindex="-1" {{/if}}>
<div class="{{@root.prefix}}--overflow-menu-options__option-content">
asdfasdf
</div>
{{carbon-icon 'Add16'}}
</button>
</li>
{{#each items}}
<li
class="{{@root.prefix}}--overflow-menu-options__option {{#if disabled}} {{@root.prefix}}--overflow-menu-options__option--disabled {{/if}} {{#if danger}} {{@root.prefix}}--overflow-menu-options__option--danger {{/if}}"
role="presentation" {{#if disabled}} aria-disabled="true" {{/if}}>
<button class="{{@root.prefix}}--overflow-menu-options__btn" role="menuitem" {{#if title}} title="{{title}}"
{{/if}} {{#if primaryFocus}} data-floating-menu-primary-focus {{/if}} {{#if disabled}} tabindex="-1"
{{/if}}>{{label}}</button>
{{/if}} {{#if primaryFocus}} data-floating-menu-primary-focus {{/if}} {{#if disabled}} tabindex="-1" {{/if}}>
<div class="{{@root.prefix}}--overflow-menu-options__option-content">
{{label}}
</div>
</button>
</li>
{{/each}}
</ul>
Expand All @@ -52,8 +66,11 @@
class="{{@root.prefix}}--overflow-menu-options__option {{#if disabled}} {{@root.prefix}}--overflow-menu-options__option--disabled {{/if}} {{#if danger}} {{@root.prefix}}--overflow-menu-options__option--danger {{/if}}"
role="presentation" {{#if disabled}} aria-disabled="true" {{/if}}>
<button class="{{@root.prefix}}--overflow-menu-options__btn" role="menuitem" {{#if title}} title="{{title}}"
{{/if}} {{#if primaryFocus}} data-floating-menu-primary-focus {{/if}} {{#if disabled}} tabindex="-1"
{{/if}}>{{label}}</button>
{{/if}} {{#if primaryFocus}} data-floating-menu-primary-focus {{/if}} {{#if disabled}} tabindex="-1" {{/if}}>
<div class="{{@root.prefix}}--overflow-menu-options__option-content">
{{label}}
</div>
</button>
</li>
{{/each}}
</ul>
Expand All @@ -80,7 +97,11 @@
role="presentation">
<a href="https://www.ibm.com" class="{{@root.prefix}}--overflow-menu-options__btn" role="menuitem" {{#if title}}
title="{{title}}" {{/if}} {{#if primaryFocus}} data-floating-menu-primary-focus{{/if}}{{#if disabled}}
tabindex="-1" {{/if}}>{{label}}</a>
tabindex="-1" {{/if}}>
<div class="{{@root.prefix}}--overflow-menu-options__option-content">
{{label}}
</div>
</a>
</li>
{{/each}}
</ul>
Expand Down

0 comments on commit 1c8fc74

Please sign in to comment.