pinafore/routes/_components/status/StatusAuthorName.html
2018-02-09 22:55:11 -08:00

57 lines
1.6 KiB
HTML

<a class="status-author-name {{isStatusInNotification ? 'status-in-notification' : '' }} {{isStatusInOwnThread ? 'status-in-own-thread' : ''}}"
href="/accounts/{{status.account.id}}">
{{status.account.display_name || status.account.username}}
</a>
<style>
.status-author-name {
grid-area: author-name;
align-self: center;
margin-left: 5px;
font-size: 1.1em;
min-width: 0;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.status-author-name.status-in-own-thread {
font-size: 1.3em;
}
.status-author-name, .status-author-name:hover, .status-author-name:visited {
color: var(--body-text-color);
}
.status-author-name.status-in-notification,
.status-author-name.status-in-notification:hover,
.status-author-name.status-in-notification:visited {
color: var(--very-deemphasized-text-color);
}
</style>
<script>
import IntlRelativeFormat from 'intl-relativeformat'
import ExternalLink from '../ExternalLink.html'
import { mark, stop } from '../../_utils/marks'
const relativeFormat = new IntlRelativeFormat('en-US');
export default {
helpers: {
getClass: isStatusInNotification => isStatusInNotification ? 'status-author-in-notification' : ''
},
computed: {
createdAtDate: (status) => status.created_at,
relativeDate: (createdAtDate) => {
mark('compute relativeDate')
let res = relativeFormat.format(new Date(createdAtDate))
stop('compute relativeDate')
return res
}
},
components: {
ExternalLink
}
}
</script>