Skip to content

Commit

Permalink
Fixes liferay#1268 - Create deltemplate for dropdown item separator
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Lancha authored and bryceosterhaus committed Nov 5, 2018
1 parent fe22795 commit f998eb7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
6 changes: 6 additions & 0 deletions packages/clay-dropdown/src/ClayDropdownBase.soy
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@
{param spritemap: $spritemap /}
{param title: $item.title /}
{/call}

{if $item.separator}
{call ClayDropdownItem.render}
{param contentRenderer: 'separator' /}
{/call}
{/if}
{/for}
{/template}

Expand Down
2 changes: 1 addition & 1 deletion packages/clay-dropdown/src/ClayDropdownItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ ClayDropdownItem.STATE = {
* @memberof ClayDropdownItem
* @type {?(string|undefined)}
*/
label: itemShape.label.required(),
label: itemShape.label,

/**
* Number of max child items of the item.
Expand Down
45 changes: 24 additions & 21 deletions packages/clay-dropdown/src/ClayDropdownItem.soy
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*
*/
{template .render}
{@param label: string}
{@param? _handleItemClick: any}
{@param? active: bool}
{@param? checked: bool}
Expand All @@ -16,6 +15,7 @@
{@param? inputValue: string}
{@param? items: list<?>}
{@param? itemsIconAlignment: string}
{@param? label: string}
{@param? maxItems: int}
{@param? separator: bool}
{@param? spritemap: string}
Expand Down Expand Up @@ -131,10 +131,6 @@
<li {$itemAttributes}>
{$itemContent}
</li>

{if $separator}
<li aria-hidden="true" class="dropdown-divider" role="presentation"></li>
{/if}
{/deltemplate}

/**
Expand Down Expand Up @@ -181,10 +177,6 @@
<li {$itemAttributes}>
{$checkbox}
</li>

{if $separator}
<li aria-hidden="true" class="dropdown-divider" role="presentation"></li>
{/if}
{/deltemplate}

/**
Expand Down Expand Up @@ -222,10 +214,6 @@
{param spritemap: $spritemap /}
{/call}
{/if}

{if $separator}
<li aria-hidden="true" class="dropdown-divider" role="presentation"></li>
{/if}
{/deltemplate}

/**
Expand Down Expand Up @@ -272,10 +260,6 @@
<li {$itemAttributes}>
{$radio}
</li>

{if $separator}
<li aria-hidden="true" class="dropdown-divider" role="presentation"></li>
{/if}
{/deltemplate}


Expand Down Expand Up @@ -319,8 +303,27 @@
</ul>
{/if}
</li>
{/deltemplate}

{if $separator}
<li aria-hidden="true" class="dropdown-divider" role="presentation"></li>
{/if}
{/deltemplate}
/**
* Renders list separator
*/
{deltemplate ClayDropdownItem.Item variant="'separator'"}
{@param label: string}
{@param? _handleItemClick: any}
{@param? active: bool}
{@param? checked: bool}
{@param? disabled: bool}
{@param? href: string}
{@param? icon: string}
{@param? inputName: string}
{@param? inputValue: string}
{@param? items: list<?>}
{@param? itemsIconAlignment: string}
{@param? maxItems: int}
{@param? separator: bool}
{@param? spritemap: string}
{@param? title: string}

<li aria-hidden="true" class="dropdown-divider" role="presentation"></li>
{/deltemplate}

0 comments on commit f998eb7

Please sign in to comment.