Commit 76d03be3 authored by Lyza Danger Gardner's avatar Lyza Danger Gardner Committed by Lyza Gardner

Adjust styling on document metadata

Make sure document titles that are not linked don't look like links.
parent bc58c21c
......@@ -17,17 +17,13 @@ import propTypes from 'prop-types';
*/
export default function AnnotationDocumentInfo({ domain, link, title }) {
return (
<div className="AnnotationDocumentInfo u-layout-row u-horizontal-rhythm">
<div className="AnnotationDocumentInfo__title u-color-text--muted">
<div className="u-layout-row u-horizontal-rhythm">
<div className="u-color-text--muted">
on &quot;
{link ? <a href={link}>{title}</a> : <span>{title}</span>}
&quot;
</div>
{domain && (
<div className="AnnotationDocumentInfo__domain u-color-text--muted">
({domain})
</div>
)}
{domain && <span className="u-color-text--muted">({domain})</span>}
</div>
);
}
......
......@@ -80,13 +80,16 @@ export default function AnnotationTimestamps({
return (
<div className="AnnotationTimestamps">
{withEditedTimestamp && (
<span className="AnnotationTimestamps__edited" title={updated.absolute}>
<span
className="AnnotationTimestamps__timestamp AnnotationTimestamps__edited"
title={updated.absolute}
>
({editedString}){' '}
</span>
)}
{annotationUrl ? (
<a
className="AnnotationTimestamps__created"
className="AnnotationTimestamps__timestamp AnnotationTimestamps__timestamp--linked"
target="_blank"
rel="noopener noreferrer"
title={created.absolute}
......@@ -96,7 +99,7 @@ export default function AnnotationTimestamps({
</a>
) : (
<span
className="AnnotationTimestamps__created"
className="AnnotationTimestamps__timestamp AnnotationTimestamps__created"
title={created.absolute}
>
{created.relative}
......
......@@ -18,23 +18,21 @@ describe('AnnotationDocumentInfo', () => {
it('should render the document title', () => {
const wrapper = createAnnotationDocumentInfo();
const info = wrapper.find('.AnnotationDocumentInfo__title');
assert.equal(info.text(), 'on "Turtles"');
assert.include(wrapper.text(), '"Turtles"');
});
it('should render a link if available', () => {
const wrapper = createAnnotationDocumentInfo();
const link = wrapper.find('.AnnotationDocumentInfo__title a');
const link = wrapper.find('a');
assert.equal(link.prop('href'), 'http://www.baz');
});
it('should render domain if available', () => {
const wrapper = createAnnotationDocumentInfo();
const domain = wrapper.find('.AnnotationDocumentInfo__domain');
assert.equal(domain.text(), '(www.foo.bar)');
assert.include(wrapper.text(), '(www.foo.bar)');
});
it(
......
......@@ -46,7 +46,7 @@ describe('AnnotationTimestamps', () => {
it('renders a linked created timestamp if annotation has a link', () => {
const wrapper = createComponent();
const link = wrapper.find('a.AnnotationTimestamps__created');
const link = wrapper.find('a');
assert.equal(link.prop('href'), 'http://www.example.com');
assert.equal(link.prop('title'), 'absolute date');
assert.equal(link.text(), 'fuzzy string');
......@@ -55,7 +55,7 @@ describe('AnnotationTimestamps', () => {
it('renders an unlinked created timestamp if annotation does not have a link', () => {
const wrapper = createComponent({ annotationUrl: '' });
const link = wrapper.find('a.AnnotationTimestamps__created');
const link = wrapper.find('a');
const span = wrapper.find('span.AnnotationTimestamps__created');
assert.isFalse(link.exists());
assert.isTrue(span.exists());
......
......@@ -2,16 +2,19 @@
@use "../../mixins/utils";
.AnnotationTimestamps {
&__edited {
@include utils.font--small;
font-style: italic;
&__timestamp {
color: var.$color-text--light;
}
&__created {
color: var.$color-text--light;
&:hover {
text-decoration: underline;
&--linked {
&:hover {
color: var.$color-text--light;
text-decoration: underline;
}
}
}
&__edited {
@include utils.font--small;
font-style: italic;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment