Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(audio-player): use rh-icon instead of custom svg for scrubbers #2095

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
5 changes: 5 additions & 0 deletions .changeset/spotty-steaks-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rhds/elements": patch
---

`<rh-audio-player>`: updated icons to use rh-icon
38 changes: 29 additions & 9 deletions elements/rh-audio-player/rh-audio-player.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,8 @@ rh-audio-player-rate-stepper {
width: auto;
}

svg.scrubber {
fill: var(--_text-color);
height: var(--_svg-size);
width: var(--_svg-size);
.scrubber {
color: var(--_text-color);
padding: var(--_icon-padding);
}

Expand Down Expand Up @@ -340,8 +338,8 @@ input[type='range'] {
#play-tooltip {
margin: 0;

--_icon-gap: 16px;
--rh-icon-size: 18px;
--_icon-gap: var(--rh-space-lg, 16px);
--rh-icon-size: var(--rh-size-icon-01, 16px);
}

#full-play-tooltip {
Expand All @@ -353,7 +351,8 @@ input[type='range'] {
#full-play-tooltip,
#mute-tooltip,
#close-tooltip,
#menu-tooltip {
#menu-tooltip,
.scrubber {
--rh-icon-size: var(--rh-size-icon-02, 24px);
}

Expand Down Expand Up @@ -447,8 +446,29 @@ rh-menu > button:focus {
#play,
#full-play {
border-radius: 50%;
background-color: var(--_surface-color);
color: var(--rh-audio-player-icon-background-color, var(--_text-color));
background-color: var(--rh-color-surface-darkest, #151515);
color:
var(--rh-audio-player-icon-background-color,
var(--rh-color-text-primary-on-dark, #ffffff));

/* stylelint-disable-next-line no-descending-specificity */
& rh-icon {
translate: 0% 10%;

&[icon='play-fill'] {
translate: 9% 10%;
}
}
}

.dark {
#play,
#full-play {
background-color: var(--rh-color-surface-lightest, #ffffff);
color:
var(--rh-audio-player-icon-background-color,
var(--rh-color-text-primary-on-light, #151515));
}
}

.expanded {
Expand Down
24 changes: 4 additions & 20 deletions elements/rh-audio-player/rh-audio-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import buttonStyles from './rh-audio-player-button.css';
import rangeStyles from './rh-audio-player-range-styles.css';
import styles from './rh-audio-player.css';

import '@rhds/elements/rh-surface/rh-surface.js';
import '@rhds/elements/rh-tooltip/rh-tooltip.js';
import '@rhds/elements/rh-icon/rh-icon.js';

Expand Down Expand Up @@ -366,8 +365,7 @@ export class RhAudioPlayer extends LitElement {
const accentColor = !!this.#styles?.getPropertyValue('--rh-audio-player-background-color');

return html`
<rh-surface id="container"
color-palette="${ifDefined(this.colorPalette)}"
<div id="container"
class="${classMap({
[on]: true,
[dir]: true,
Expand Down Expand Up @@ -484,14 +482,7 @@ export class RhAudioPlayer extends LitElement {
class="toolbar-button"
?disabled=${rewinddisabled}
@click=${() => this.rewind()}>
<svg xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 32 32"
class="scrubber"
role="presentation">
<path d="M10.4,19.5h1.8v-5l-1.8,0.8v-1l2.2-0.9h0.7v6.2h1.9v1h-4.8V19.5z"/>
<path d="M16.4,19.6l0.7-0.8c0.6,0.5,1.2,0.8,1.9,0.8c0.9,0,1.5-0.6,1.5-1.4c0-0.8-0.6-1.3-1.5-1.3 c-0.5,0-0.9,0.1-1.4,0.4L16.8,17l0.2-3.7h4.3v1h-3.3l-0.1,2c0.5-0.2,1-0.3,1.5-0.3c1.4,0,2.4,0.9,2.4,2.1c0,1.4-1.1,2.4-2.7,2.4 C18,20.5,17.1,20.2,16.4,19.6z"/>
<path d="M4,6.6L9.5,2v3.7h7.4c6.1,0,11.1,5,11.1,11.1c0,6.1-5,11.1-11.1,11.1H9.5V26h1.8h5.5 c5.1,0,9.2-4.1,9.2-9.2c0-5.1-4.1-9.2-9.2-9.2h-5.5H9.5v3.7L4,6.6z"/>
</svg>
<rh-icon set="ui" icon="undo" class="scrubber"></rh-icon>
</button>
<span slot="content">${this.#translation.get('rewind')}</span>
</rh-tooltip>
Expand All @@ -514,14 +505,7 @@ export class RhAudioPlayer extends LitElement {
class="toolbar-button"
?disabled=${forwarddisabled}
@click=${() => this.forward()}>
<svg xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 32 32"
class="scrubber"
role="presentation">
<path d="M10.4,19.5h1.8v-5l-1.8,0.8v-1l2.2-0.9h0.7v6.2h1.9v1h-4.8V19.5z"/>
<path d="M16.4,19.6l0.7-0.8c0.6,0.5,1.2,0.8,1.9,0.8c0.9,0,1.5-0.6,1.5-1.4c0-0.8-0.6-1.3-1.5-1.3 c-0.5,0-0.9,0.1-1.4,0.4L16.8,17l0.2-3.7h4.3v1h-3.3l-0.1,2c0.5-0.2,1-0.3,1.5-0.3c1.4,0,2.4,0.9,2.4,2.1c0,1.4-1.1,2.4-2.7,2.4 C18,20.5,17.1,20.2,16.4,19.6z"/>
<path d="M28,6.6L22.4,2v3.7h-7.4C9,5.7,4,10.6,4,16.7c0,6.1,5,11.1,11.1,11.1h7.4V26h-1.8h-5.5c-5.1,0-9.2-4.1-9.2-9.2 c0-5.1,4.1-9.2,9.2-9.2h5.5h1.8v3.7L28,6.6z"/>
</svg>
<rh-icon set="ui" icon="redo" class="scrubber"></rh-icon>
</button>
<span slot="content">${this.#translation.get('advance')}</span>
</rh-tooltip>`}${!this.#hasMenu ? '' : html`
Expand Down Expand Up @@ -600,7 +584,7 @@ export class RhAudioPlayer extends LitElement {
@transcriptdownload=${this.#onTranscriptDownload}>
</slot>
</div>
</rh-surface>
</div>
`;
}

Expand Down
Loading