Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ import rehypeSlug from "rehype-slug";
export default defineConfig({
site: "https://sentry.engineering",
output: "static",
experimental: {
csp: {
scriptDirective: {
resources: ["'self'", "https://plausible.io"],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs "https://platform.twitter.com" due to reduce-ci-time-with-nx-caching. Or we could just replace it with a screenshot.

hashes: [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a note in an MD somewhere that these will change if the scripts are ever modified, but hopefully it's self-evident

"sha256-t7UDmDY4iklZOU6hhoaa4oMgQfLaBBT9DlTNiRW7xE0=", // Theme init
"sha256-p7WGvXPfCjOpbo9APNa4AJgj/jO9xZr9aBlEFVcuKUM=", // Plausible init
"sha256-sVlNBziRgfCssLPd9yhI6q2CTDvIhhkPyoUn5B+G1HI=", // Theme toggle
"sha256-m+TqEPNJoIsN5pFYeHFt2az1Myng7rZ6Y/9yJIokBrk=", // Post list search
],
},
styleDirective: {
resources: ["'self'", "'unsafe-inline'"],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yarp, have to do it. No real way around it. Style injection will still be possible but the risk is much lower

},
directives: ["connect-src 'self' https://plausible.io"],
},
},
integrations: [sitemap()],
image: {
service: {
Expand Down
Binary file added public/fonts/JetBrainsMono-Bold.woff2
Binary file not shown.
Binary file added public/fonts/JetBrainsMono-Italic.woff2
Binary file not shown.
Binary file added public/fonts/JetBrainsMono-Light.woff2
Binary file not shown.
Binary file added public/fonts/JetBrainsMono-Medium.woff2
Binary file not shown.
Binary file added public/fonts/JetBrainsMono-Regular.woff2
Binary file not shown.
Binary file added public/fonts/JetBrainsMono-SemiBold.woff2
Binary file not shown.
18 changes: 9 additions & 9 deletions src/components/PostList.astro
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const postsWithMeta = posts.map((post) => {
})
---

<div id={listId}>
<div id={listId} data-post-list-id={listId}>
<div class="space-y-4 pb-8 pt-10">
<div class="flex items-center justify-between">
<h1 class="text-xs font-normal uppercase tracking-widest text-gray-400 dark:text-gray-500">
Expand Down Expand Up @@ -66,7 +66,7 @@ const postsWithMeta = posts.map((post) => {
</div>

<ul class="flex flex-col gap-px" data-post-list>
<li class="text-sm text-[#5b6270] dark:text-[#8a8a8a]" data-empty style={postsWithMeta.length === 0 ? '' : 'display: none;'}>
<li class:list={['text-sm text-[#5b6270] dark:text-[#8a8a8a]', { hidden: postsWithMeta.length > 0 }]} data-empty>
No posts found.
</li>
{
Expand Down Expand Up @@ -136,9 +136,9 @@ const postsWithMeta = posts.map((post) => {
</div>
)}

<script define:vars={{ listId }}>
const root = document.getElementById(listId)
if (root) {
<script is:inline>
document.querySelectorAll('[data-post-list-id]').forEach((root) => {
const listId = root.getAttribute('data-post-list-id')
const input = root.querySelector('[data-search-input]')
const items = Array.from(root.querySelectorAll('[data-post-item]'))
const emptyState = root.querySelector('[data-empty]')
Expand All @@ -152,23 +152,23 @@ const postsWithMeta = posts.map((post) => {
for (const item of items) {
const haystack = item.getAttribute('data-search-content') ?? ''
const isMatch = query.length === 0 || haystack.includes(query)
item.style.display = isMatch ? '' : 'none'
item.classList.toggle('hidden', !isMatch)
if (isMatch) {
visible += 1
}
}

if (emptyState) {
emptyState.style.display = visible === 0 ? '' : 'none'
emptyState.classList.toggle('hidden', visible > 0)
}

if (pagination) {
pagination.style.display = query.length === 0 ? '' : 'none'
pagination.classList.toggle('hidden', query.length > 0)
}
}

input.addEventListener('input', update)
update()
}
}
})
</script>
6 changes: 0 additions & 6 deletions src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ const footerLinks = [
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicons/favicon-16x16.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/static/favicons/apple-touch-icon.png" />
<link rel="manifest" href="/site.webmanifest" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap"
rel="stylesheet"
/>
<script is:inline>
(() => {
try {
Expand Down
48 changes: 48 additions & 0 deletions src/styles/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,51 @@
@plugin "@tailwindcss/typography";

@custom-variant dark (&:where(.dark, .dark *));

@font-face {
font-family: "JetBrains Mono";
font-style: normal;
font-weight: 300;
font-display: swap;
src: url("/fonts/JetBrainsMono-Light.woff2") format("woff2");
}

@font-face {
font-family: "JetBrains Mono";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
}

@font-face {
font-family: "JetBrains Mono";
font-style: italic;
font-weight: 400;
font-display: swap;
src: url("/fonts/JetBrainsMono-Italic.woff2") format("woff2");
}

@font-face {
font-family: "JetBrains Mono";
font-style: normal;
font-weight: 500;
font-display: swap;
src: url("/fonts/JetBrainsMono-Medium.woff2") format("woff2");
}

@font-face {
font-family: "JetBrains Mono";
font-style: normal;
font-weight: 600;
font-display: swap;
src: url("/fonts/JetBrainsMono-SemiBold.woff2") format("woff2");
}

@font-face {
font-family: "JetBrains Mono";
font-style: normal;
font-weight: 700;
font-display: swap;
src: url("/fonts/JetBrainsMono-Bold.woff2") format("woff2");
}