pinafore/routes/_components/Status.html

207 lines
4.3 KiB
HTML
Raw Normal View History

2018-01-15 03:28:50 +00:00
<article>
2018-01-11 04:45:02 +00:00
{{#if status.reblog}}
2018-01-15 03:28:50 +00:00
<div class="boosted">
<svg>
<use xlink:href="#fa-retweet" />
</svg>
<span>
<a href="/accounts/{{status.account.id}}">
{{status.account.username}}
</a> boosted
</span>
2018-01-11 04:45:02 +00:00
</div>
{{/if}}
2018-01-15 03:28:50 +00:00
<div class="author">
2018-01-15 05:41:19 +00:00
<a class="author-name" href="/accounts/{{original.id}}">
{{original.display_name || original.username}}
2018-01-15 03:28:50 +00:00
</a>
<span class="author-handle">
2018-01-15 05:41:19 +00:00
@{{original.acct}}
2018-01-15 03:28:50 +00:00
</span>
2018-01-15 05:41:19 +00:00
<a class="author-relative-date" rel="noopener" target="_blank" href="{{original.url}}">
2018-01-15 03:28:50 +00:00
{{relativeDate}}
</a>
</div>
2018-01-11 04:45:02 +00:00
<div class="sidebar">
2018-01-15 05:41:19 +00:00
<Avatar account={{original}} />
2018-01-11 04:45:02 +00:00
</div>
<div class="content">{{{status.content}}}</div>
2018-01-15 03:28:50 +00:00
<div class="toolbar">
2018-01-13 07:24:05 +00:00
<button aria-label="Reply" aria-pressed="false" type="button">
<svg>
<use xlink:href="#fa-reply" />
</svg>
2018-01-11 04:45:02 +00:00
</button>
2018-01-13 07:24:05 +00:00
<button aria-label="Boost" aria-pressed="false" type="button">
<svg>
<use xlink:href="#fa-retweet" />
</svg>
2018-01-11 04:45:02 +00:00
</button>
2018-01-13 07:24:05 +00:00
<button aria-label="Favorite" aria-pressed="false" type="button">
<svg>
<use xlink:href="#fa-star" />
</svg>
2018-01-11 04:45:02 +00:00
</button>
2018-01-13 07:24:05 +00:00
<button aria-label="More" aria-pressed="false" type="button">
<svg>
<use xlink:href="#fa-ellipsis-h" />
</svg>
2018-01-11 04:45:02 +00:00
</button>
</div>
</article>
<style>
article {
2018-01-16 04:51:51 +00:00
width: 570px;
max-width: calc(100vw - 30px);
2018-01-11 04:59:04 +00:00
margin: 0 auto;
2018-01-11 08:26:35 +00:00
padding: 10px 0;
2018-01-11 04:45:02 +00:00
display: grid;
grid-template-areas:
2018-01-15 03:28:50 +00:00
"....... boosted"
"sidebar author"
2018-01-11 04:45:02 +00:00
"sidebar content"
2018-01-15 03:28:50 +00:00
"....... toolbar";
2018-01-15 05:41:19 +00:00
grid-template-columns: 60px 1fr;
2018-01-11 04:45:02 +00:00
}
.sidebar {
grid-area: sidebar;
display: flex;
}
2018-01-15 03:28:50 +00:00
.author {
grid-area: author;
display: flex;
align-items: center;
margin-left: 5px;
font-size: 1.1em;
2018-01-15 05:41:19 +00:00
min-width: 0;
2018-01-15 03:28:50 +00:00
}
.author a, .author a:visited, .author a:hover, .author .author-handle {
color: var(--deemphasized-text-color);
}
.author .author-name {
min-width: 0;
flex-shrink: 1;
2018-01-15 05:41:19 +00:00
color: var(--body-text-color);
2018-01-15 03:28:50 +00:00
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.author .author-name:hover {
color: var(--body-text-color);
}
.author-handle {
min-width: 0;
flex: 1;
margin-left: 5px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.author-relative-date {
flex-shrink: 1;
text-align: right;
margin-left: 5px;
white-space: nowrap;
}
2018-01-11 04:45:02 +00:00
.content {
2018-01-15 05:41:19 +00:00
margin: 10px 5px 20px;
2018-01-11 04:45:02 +00:00
grid-area: content;
word-wrap: break-word;
overflow: hidden;
white-space: pre-wrap;
2018-01-11 08:26:35 +00:00
font-size: 0.9em;
2018-01-11 04:45:02 +00:00
}
2018-01-15 03:28:50 +00:00
:global(.content p) {
margin: 0 0 20px;
2018-01-11 05:31:33 +00:00
}
2018-01-15 03:28:50 +00:00
:global(.content p:first-child) {
margin: 0 0 20px;
2018-01-11 05:31:33 +00:00
}
2018-01-15 03:28:50 +00:00
:global(.content p:last-child) {
margin: 0;
}
.boosted span {
margin-left: 5px;
}
.boosted span, .boosted a, .boosted a:visited, .boosted a:hover {
color: var(--deemphasized-text-color);
2018-01-11 08:26:35 +00:00
}
2018-01-15 03:28:50 +00:00
.boosted {
grid-area: boosted;
2018-01-11 08:26:35 +00:00
margin: 5px 5px;
2018-01-15 03:28:50 +00:00
display: flex;
align-items: center;
}
.boosted svg {
width: 18px;
height: 18px;
fill: var(--deemphasized-text-color)
2018-01-11 04:45:02 +00:00
}
2018-01-15 03:28:50 +00:00
.toolbar {
grid-area: toolbar;
2018-01-11 04:45:02 +00:00
display: flex;
2018-01-11 04:59:04 +00:00
margin: 5px;
2018-01-11 08:26:35 +00:00
justify-content: space-between;
2018-01-11 04:45:02 +00:00
}
2018-01-15 03:28:50 +00:00
.toolbar button {
2018-01-11 08:26:35 +00:00
padding: 0;
background: none;
border: none;
2018-01-11 04:45:02 +00:00
}
2018-01-15 03:28:50 +00:00
.toolbar button svg {
2018-01-11 08:26:35 +00:00
width: 24px;
height: 24px;
2018-01-13 02:12:39 +00:00
fill: var(--action-button-fill-color);
}
2018-01-15 03:28:50 +00:00
.toolbar button:hover svg {
2018-01-13 02:12:39 +00:00
fill: var(--action-button-fill-color-hover);
}
2018-01-15 03:28:50 +00:00
.toolbar button:active svg {
2018-01-13 02:12:39 +00:00
fill: var(--action-button-fill-color-active);
2018-01-11 04:45:02 +00:00
}
</style>
<script>
import Avatar from './Avatar.html'
2018-01-15 03:28:50 +00:00
import IntlRelativeFormat from 'intl-relativeformat'
const relativeFormat = new IntlRelativeFormat('en-US');
2018-01-11 04:45:02 +00:00
export default {
components: {
Avatar
},
2018-01-15 03:28:50 +00:00
computed: {
2018-01-16 01:25:32 +00:00
createdAtDate: (status) => status.created_at,
relativeDate: (createdAtDate) => {
return relativeFormat.format(new Date(createdAtDate))
2018-01-15 05:41:19 +00:00
},
original: (status) => status.reblog ? status.reblog.account : status.account
2018-01-15 03:28:50 +00:00
},
2018-01-11 05:31:33 +00:00
methods: {
alert: function (e) {
e.preventDefault()
window.alert(e.target)
}
}
2018-01-11 04:45:02 +00:00
}
</script>