pinafore/routes/_components/status/Status.html
Nolan Lawson faae26863f refactor
2018-02-04 12:10:02 -08:00

81 lines
2.9 KiB
HTML

<article class="status-article {{originalStatus.visibility === 'direct' ? 'status-direct' : ''}}"
tabindex="0"
aria-posinset="{{index}}" aria-setsize="{{length}}"
on:recalculateHeight>
{{#if (notification && (notification.type === 'reblog' || notification.type === 'favourite')) || status.reblog}}
<StatusHeader :notification :status />
{{/if}}
<StatusAuthor status="{{originalStatus}}" :isStatusInOwnThread />
<StatusSidebar status="{{originalStatus}}" />
{{#if originalStatus.spoiler_text}}
<StatusSpoiler status="{{originalStatus}}" :spoilerShown on:recalculateHeight />
{{/if}}
{{#if !originalStatus.spoiler_text || spoilerShown}}
<StatusContent status="{{originalStatus}}" :isStatusInOwnThread />
{{/if}}
{{#if hasMedia}}
<StatusMediaAttachments status="{{originalStatus}}" on:recalculateHeight />
{{/if}}
<StatusToolbar :status />
</article>
<style>
.status-article {
width: 560px;
max-width: calc(100vw - 40px);
padding: 10px 20px;
border-bottom: 1px solid var(--main-border);
display: grid;
grid-template-areas:
".............. status-header"
"status-sidebar status-author"
"status-sidebar status-spoiler"
"status-sidebar status-spoiler-button"
"status-sidebar status-content"
"status-media status-media"
".............. status-toolbar";
grid-template-columns: 58px 1fr;
}
.status-article.status-direct {
background-color: var(--status-direct-background);
}
@media (max-width: 767px) {
.status-article {
padding: 10px 10px;
max-width: calc(100vw - 20px);
}
}
</style>
<script>
import StatusSidebar from './StatusSidebar.html'
import StatusHeader from './StatusHeader.html'
import StatusAuthor from './StatusAuthor.html'
import StatusContent from './StatusContent.html'
import StatusToolbar from './StatusToolbar.html'
import StatusSpoiler from './StatusSpoiler.html'
import StatusMediaAttachments from './StatusMediaAttachments.html'
import { store } from '../../_store/store'
export default {
components: {
StatusSidebar,
StatusHeader,
StatusAuthor,
StatusContent,
StatusToolbar,
StatusSpoiler,
StatusMediaAttachments,
},
store: () => store,
computed: {
originalStatus: (status) => status.reblog ? status.reblog : status,
statusId: (originalStatus) => originalStatus.id,
hasMedia: (originalStatus) => originalStatus.media_attachments && originalStatus.media_attachments.length,
isStatusInOwnThread: (timelineType, timelineValue, statusId) => timelineType === 'status' && timelineValue === statusId,
originalAccount: (originalStatus) => originalStatus.account,
spoilerShown: ($spoilersShown, $currentInstance, statusId) => $spoilersShown && $spoilersShown[$currentInstance] && $spoilersShown[$currentInstance][statusId]
}
}
</script>