Skip to content

Commit

Permalink
fix(search-bar): button disabled + contrasted
Browse files Browse the repository at this point in the history
  • Loading branch information
aesteves60 authored and dpellier committed Aug 4, 2023
1 parent 84070ec commit 9352323
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@
}

:host([disabled]) {
cursor: not-allowed;
pointer-events: none;
@include osds-button-on-main-element() {
cursor: not-allowed;
}
}

:host([inline]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@
}
}

:host([disabled]) {
cursor: not-allowed;
:host([contrasted]) {
osds-button {
&::part(button) {
border: solid var(--ods-size-01) var(--ods-color-primary-200);
border-left: 0;
}
}
}

// apply the theme template for the component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, Element, Host, h, Prop, Event, EventEmitter, Listen } from '
import {
OdsButtonSize,
OdsIconName,
OdsIconSize,
OdsInputType,
OdsInputValueChangeEvent,
OdsSearchBar,
Expand Down Expand Up @@ -111,7 +112,10 @@ export class OsdsSearchBar implements OdsSearchBar<OdsStencilMethods<OdsSearchBa
color={ OdsThemeColorIntent.primary }
disabled={ this.disabled }
contrasted={ this.contrasted }>
<osds-icon contrasted name={ OdsIconName.SEARCH } />
<osds-icon
size={ OdsIconSize.sm }
contrasted={ !this.contrasted }
name={ OdsIconName.SEARCH } />
</osds-button>
</Host>
);
Expand Down
3 changes: 3 additions & 0 deletions packages/stencil/components/search-bar/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
<p>SearchBar disabled</p>
<osds-search-bar disabled></osds-search-bar>

<p>SearchBar contrasted</p>
<osds-search-bar contrasted></osds-search-bar>

<script>
const searchBarOptions = document.querySelector('#search-bar-options');
searchBarOptions.options = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ export default {
argTypes: extractArgTypes({ ...storyParams, ...selectParams })
};

/* Default */

const TemplateDefault = (args:any) => {
return html`
<osds-search-bar ...=${getTagAttributes(args)}>
<osds-search-bar ...=${getTagAttributes(args)} @keydown=${(e: KeyboardEvent) => e.stopPropagation()}>
SearchBar
</osds-search-bar>
`;
Expand All @@ -73,10 +73,10 @@ Default.args = {
...extractStoryParams(storyParams),
};

/* Default */

const SelectTemplate = (args:any) => {
return html`
<osds-search-bar ...=${getTagAttributes(args)}>
<osds-search-bar ...=${getTagAttributes(args)} @keydown=${(e: KeyboardEvent) => e.stopPropagation()}>
SearchBar
</osds-search-bar>
`;
Expand Down
1 change: 1 addition & 0 deletions scripts/testing-report/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
{name: 'osds-radio', id: 'radio'},
{name: 'osds-radio-button', id: 'radio-button'},
{name: 'osds-range', id: 'range'},
{name: 'osds-search-bar', id: 'search-bar'},
{name: 'osds-select', id: 'select'},
{name: 'osds-skeleton', id: 'skeleton'},
{name: 'osds-spinner', id: 'spinner'},
Expand Down

0 comments on commit 9352323

Please sign in to comment.