Skip to content

Commit

Permalink
Add data-href attribute if there is a resource
Browse files Browse the repository at this point in the history
  • Loading branch information
bosschaert committed Mar 22, 2024
1 parent 9341723 commit 28456cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions blocks/edit/da-versions/da-versions.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
list-style-type: square;
}

.da-versions-panel li[data-href] {
font-weight: 700;
}

.da-versions-panel li:focus {
background: rgb(239, 239, 239);
}
Expand Down
8 changes: 5 additions & 3 deletions blocks/edit/da-versions/da-versions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LitElement, html, until } from '../../../deps/lit/lit-all.min.js';
import { LitElement, html, ifDefined, until } from '../../../deps/lit/lit-all.min.js';
import getSheet from '../../shared/sheet.js';

const sheet = await getSheet('/blocks/edit/da-versions/da-versions.css');
Expand Down Expand Up @@ -57,8 +57,10 @@ export default class DaVersions extends LitElement {

const versions = [];
for (const l of list) {
versions.push(html`<li tabindex="1">${new Date(l.timestamp).toLocaleDateString()}
<br>${l.authors.join(', ')}</li>`);
versions.push(html`
<li tabindex="1" data-href="${ifDefined(l.resource)}">
${new Date(l.timestamp).toLocaleString([], { dateStyle: 'full', timeStyle: 'short' })}
<br/>${l.authors.join(', ')}</li>`);
}
return versions;
}
Expand Down

0 comments on commit 28456cc

Please sign in to comment.