Skip to content

Commit

Permalink
Revert "Make fallback notice sticky & dismissible"
Browse files Browse the repository at this point in the history
This reverts commit 81fff11.
  • Loading branch information
delucis committed Jun 18, 2022
1 parent 81fff11 commit f7fb1c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 70 deletions.
72 changes: 4 additions & 68 deletions src/components/FallbackNotice.astro
Original file line number Diff line number Diff line change
@@ -1,73 +1,9 @@
---
import Aside from './Aside.astro';
import UIString from './UIString.astro';
import { useTranslations } from '../i18n/util';
const t = useTranslations(Astro);
---

<div class="fallback-notice">
<input type="checkbox" id="fallback-notice-close-checkbox" class="sr-only" aria-hidden="true">
<label for="fallback-notice-close-checkbox" aria-hidden="true">
<UIString key="fallbackContent.closeLabel" />
</label>
<Aside type="caution" title={t('fallbackContent.title')}>
<UIString key="fallbackContent.notice" />
<a href="https://github.com/withastro/docs/blob/main/src/i18n#readme">
<UIString key="fallbackContent.linkText" />
</a>
</Aside>
</div>

<style>
.fallback-notice {
position: fixed;
bottom: .5rem;
left: 50%;
transform: translateX(-50%);
width: calc(100% - 1rem);
max-width: 35rem;
z-index: 5;
background: var(--theme-bg-gradient-bottom);
}

@media (min-width: 37.75em) {
.fallback-notice {
bottom: 1.5rem;
z-index: 50;
}
}

@media (min-width: 50em) {
.fallback-notice {
bottom: 2.5rem;
}
}

.fallback-notice :global(aside) {
box-shadow: 0 0 var(--theme-glow-blur) var(--theme-glow-diffuse);
}

label {
position: absolute;
top: 0;
right: 0;
font-size: .875rem;
padding: .375rem .625rem;
color: var(--theme-text-lighter);
}

:global(.theme-dark) label {
color: var(--theme-text);
}

/* Highlight label for keyboard users */
input[type="checkbox"]:focus-visible~label {
outline: 2px solid currentColor;
}

/* Hide fallback notice when checkbox is checked */
input[type="checkbox"]:checked,
input[type="checkbox"]:checked~ :global(*) {
display: none
}
</style>
<Aside>
<UIString key="fallbackContent.notice" />
<a href="https://github.com/withastro/docs/blob/main/src/i18n#readme"><UIString key="fallbackContent.linkText" /></a>
</Aside>
2 changes: 0 additions & 2 deletions src/i18n/en/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export default {
// `<ContributorList>` fallback text
'contributors.seeAll': 'See all contributors',
// Fallback content notice shown when a page is not yet translated
'fallbackContent.closeLabel': 'Close',
'fallbackContent.title': 'Not translated',
'fallbackContent.notice': 'This page is not yet available in your language, so we’re showing you the English version. You can help by translating it!',
'fallbackContent.linkText': 'Learn more about how you can contribute',
// 404 Page
Expand Down

0 comments on commit f7fb1c8

Please sign in to comment.