Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/plugins/bookmarks/bookmark-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { repeat } from 'lit/directives/repeat.js';
import { css, html, LitElement, nothing } from 'lit';
import bookmarkColorsCSS from './bookmark-colors.js';
import buttonCSS from '../../css/button-base.js';
import { sharedStyles } from '../../css/sharedStyles.js';

export class IABookmarkEdit extends LitElement {
static get properties() {
Expand Down Expand Up @@ -66,7 +67,8 @@ export class IABookmarkEdit extends LitElement {
return html`
<div class="color-option">
<input type="radio" name="color" id="color_${color.id}" .value=${color.id} @change=${() => this.changeColorTo(color.id)} ?checked=${this.bookmark.color === color.id}>
<label for="color_${color.id}" title=${color.className}>
<label for="color_${color.id}" title=${color.label}>
<span class="sr-only">${color.label}</span>
<icon-bookmark class=${color.className} aria-hidden="true"></icon-bookmark>
</label>
</div>
Expand Down Expand Up @@ -221,7 +223,7 @@ export class IABookmarkEdit extends LitElement {
justify-items: stretch;
}
`;
return [buttonCSS, bookmarkColorsCSS, bookmarkEditCSS];
return [sharedStyles, buttonCSS, bookmarkColorsCSS, bookmarkEditCSS];
}
}
customElements.define('ia-bookmark-edit', IABookmarkEdit);
4 changes: 2 additions & 2 deletions src/plugins/bookmarks/bookmarks-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ export class IABookmarksList extends LitElement {

bookmarkItem(bookmark) {
const editMode = this.editedBookmark.id === bookmark.id;
const { className } = this.bookmarkColorInfo(bookmark.color);
const { className, label } = this.bookmarkColorInfo(bookmark.color);
const activeClass = bookmark.id === this.activeBookmarkID ? 'active' : '';
return html`
<li data-pageIndex=${bookmark.id}>
<div class="separator"></div>
<div class="bookmark-card ${activeClass}">
<div class="bookmark-header" @click=${() => this.emitSelectedEvent(bookmark)}>
<button>
<icon-bookmark class=${className} aria-label="${className} bookmark"></icon-bookmark>
<icon-bookmark class=${className} aria-label="${label} bookmark"></icon-bookmark>
<span> Page ${bookmark.page}</span>
</button>
<button
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/bookmarks/ia-bookmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,15 @@ class IABookmarks extends LitElement {

this.bookmarkColors = [{
id: 0,
// FIXME: This is also used as the aria-label
label: 'Red',
className: 'red',
}, {
id: 1,
label: 'Blue',
className: 'blue',
}, {
id: 2,
label: 'Green',
className: 'green',
}];

Expand Down
5 changes: 5 additions & 0 deletions tests/jest/plugins/bookmarks/bookmark-edit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,23 @@ import '@/src/plugins/bookmarks/bookmark-edit.js';

const bookmarkColors = [{
id: 0,
label: '',
className: '',
}, {
id: 1,
label: 'Blue',
className: 'blue',
}, {
id: 2,
label: 'Red',
className: 'red',
}, {
id: 3,
label: 'Green',
className: 'green',
}, {
id: 4,
label: 'Yellow',
className: 'yellow',
}];

Expand Down