pinafore/src/routes/_components/DynamicPageBanner.html
Nolan Lawson 4bd181d3cc
fix: update Sapper to latest (#775)
* fix: update to latest sapper

fixes #416

* fix error and debug pages

* requestIdleCallback makes column switching feel way nicer than double rAF

* add export feature

* add better csp info

* workaround for sapper sub-page issue

* clarify in readme about exporting

* fix now config

* switch from rIC to triple raf

* style-loader is no longer used

* update theming guide
2018-12-11 07:31:48 -08:00

78 lines
1.7 KiB
HTML

<div class="dynamic-page-banner {icon ? 'dynamic-page-with-icon' : ''}"
role="navigation" aria-label="Page header"
>
{#if icon}
<svg class="dynamic-page-banner-svg">
<use xlink:href={icon} />
</svg>
{/if}
<h1 class="dynamic-page-title" aria-label={ariaTitle}>{title}</h1>
<button type="button"
class="dynamic-page-go-back"
aria-label="Go back"
on:click="onGoBack(event)">Back</button>
</div>
<style>
.dynamic-page-banner {
display: grid;
align-items: center;
margin: 20px 20px 20px;
grid-template-columns: 1fr min-content;
grid-column-gap: 10px;
}
.dynamic-page-banner.dynamic-page-with-icon {
grid-template-columns: min-content 1fr min-content;
}
.dynamic-page-banner-svg {
width: 24px;
height: 24px;
fill: var(--body-text-color);
}
.dynamic-page-title {
margin: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.dynamic-page-go-back {
font-size: 1.3em;
color: var(--anchor-text);
border: 0;
padding: 0;
background: none;
justify-self: flex-end;
}
.dynamic-page-go-back:hover {
text-decoration: underline;
}
.dynamic-page-go-back::before {
content: '←';
margin-right: 5px;
}
@media (max-width: 767px) {
.dynamic-page-banner {
margin: 20px 10px 20px;
}
.dynamic-page-title {
font-size: 1.3em;
}
.dynamic-page-go-back {
font-size: 1.3em;
}
}
</style>
<script>
export default {
data: () => ({
icon: void 0,
ariaTitle: ''
}),
methods: {
onGoBack (e) {
e.preventDefault()
window.history.back()
}
}
}
</script>