Skip to content

Commit

Permalink
Loading Spinner, Sidenav, Docs: use is-on-background correctly (#657)
Browse files Browse the repository at this point in the history
* fix(loading-spinner, sidenav, docs): use is-on-background correctly

* chore: add changeset

* fix: address linting issues
  • Loading branch information
daneah committed Jan 4, 2024
1 parent f8342cc commit e89bcaf
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 19 deletions.
6 changes: 6 additions & 0 deletions .changeset/eight-dots-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@ithaka/pharos': major
'@ithaka/pharos-site': major
---

Use is-on-background in place of on-background
4 changes: 2 additions & 2 deletions packages/pharos-site/static/guidelines/button.docs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ import ellipsesExample from '@images/components/button/buttons_ellipses-example.
<PageSection title="Buttons on dark background" subSectionLevel={1}>
<p>
When a button is used on a darker background (e.g., black or marble-gray-20), use the
on-background attribute. The four variants described above can all be used on dark backgrounds
and follow the same guidelines.
is-on-background attribute. The four variants described above can all be used on dark
backgrounds and follow the same guidelines.
</p>
<div
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const Validity = {
},
};

export const isOnBackground = {
export const IsOnBackground = {
name: 'On background',
render: () => (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const Validity = {
},
};

export const isOnBackground = {
export const IsOnBackground = {
name: 'On background',
render: () =>
html`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const FullWidth = {
),
};

export const isOnBackground = {
export const IsOnBackground = {
render: () => (
<div
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const FullWidth = {
},
};

export const isOnBackground = {
export const IsOnBackground = {
render: () => {
const effect = () => {
useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
align-items: center;
}

:host(:not([on-background])) .loading-spinner__wrapper {
:host(:not([is-on-background])) .loading-spinner__wrapper {
background-color: rgb(255 255 255 / 0.8);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ focusable="false"
export class PharosLoadingSpinner extends PharosElement {
/**
* Indicates if the spinner is on background
* @attr on-background
* @attr is-on-background
*/
@property({ type: Boolean, reflect: true, attribute: 'on-background' })
public onBackground = false;
@property({ type: Boolean, reflect: true, attribute: 'is-on-background' })
public isOnBackground = false;

/**
* Indicates if the spinner is small
Expand Down Expand Up @@ -111,7 +111,7 @@ export class PharosLoadingSpinner extends PharosElement {
{ stroke: PharosLoadingSpinnerColorStrokeOnBackground, offset: 0.9 },
{ stroke: PharosLoadingSpinnerColorStrokeOnBackground, offset: 1 },
];
const colorKeys = this.onBackground ? colorKeysOnBackground : colorKeysBase;
const colorKeys = this.isOnBackground ? colorKeysOnBackground : colorKeysBase;
const colorTiming: KeyframeAnimationOptions = {
easing: 'ease-in-out',
duration: 6000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const OnBackground = {
render: () =>
html`
<div style="height: 5rem; width: 5rem; background: black; position: relative;">
<storybook-pharos-loading-spinner on-background></storybook-pharos-loading-spinner>
<storybook-pharos-loading-spinner is-on-background></storybook-pharos-loading-spinner>
</div>
`,
};
Expand All @@ -57,7 +57,7 @@ export const SmallOnBackground = {
render: () =>
html`
<div style="height: 5rem; width: 5rem; background: black; position: relative;">
<storybook-pharos-loading-spinner small on-background></storybook-pharos-loading-spinner>
<storybook-pharos-loading-spinner small is-on-background></storybook-pharos-loading-spinner>
</div>
`,
};
4 changes: 2 additions & 2 deletions packages/pharos/src/components/sidenav/pharos-sidenav.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ describe('pharos-sidenav', () => {
name="my-input-group"
placeholder="Search"
hide-label
on-background
is-on-background
>
<span slot="label">Search</span>
<test-pharos-button
name="search-button"
icon="search"
variant="subtle"
a11y-label="search"
on-background
is-on-background
></test-pharos-button>
</test-pharos-input-group>
<test-pharos-sidenav-section show-divider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const Base = {
icon="search"
variant="subtle"
a11y-label="search"
on-background
is-on-background
></storybook-pharos-button>
</storybook-pharos-input-group>
<storybook-pharos-sidenav-section show-divider>
Expand Down
6 changes: 3 additions & 3 deletions packages/pharos/src/components/toast/pharos-toast.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ describe('pharos-toast', () => {
});

it('fires a custom event pharos-toast-close after closing', async () => {
let detail = null;
let actualId = '';
const handleClose = (e: Event): void => {
detail = (e as CustomEvent).detail;
actualId = (e as CustomEvent).detail.id;
};
component.addEventListener('pharos-toast-close', handleClose);

Expand All @@ -81,6 +81,6 @@ describe('pharos-toast', () => {
await component.updateComplete;
await aTimeout(500);

expect((detail as any).id === component.id).to.be.true;
expect(actualId === component.id).to.be.true;
});
});

0 comments on commit e89bcaf

Please sign in to comment.