fix: add spacing before Admin link in blog template#1968
Conversation
The Admin link currently renders directly after the final navigation item as `PostsAdmin`. This adds spacing before the Admin link in the blog template while preserving the existing mobile layout. The change is made in `theme.css` so it can flow to the Cloudflare template through the normal template sync.
|
|
All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
This is the right minimal fix for the stated layout problem. In templates/blog/src/layouts/Base.astro the .nav-admin link is a flex sibling that sits directly after .nav-right, so it renders flush against the last nav item. Adding margin-inline-start: var(--spacing-5) via CSS separates it cleanly while using an RTL-safe logical property, and the existing mobile media query already resets margin-inline-start: 0, so the mobile layout is preserved.
I verified the target class exists in both blog templates, that --spacing-5 is defined in tokens.css, and that this change is CSS-only so no changeset or Lingui update is needed. I did not run the test suite, linter, or formatter.
Two things to address before merge:
- Formatting — the new CSS is indented with spaces; this project uses tabs everywhere and
pnpm formatis part of the pre-PR checklist. Run the formatter ontemplates/blog/src/styles/theme.css. - Cloudflare variant —
templates/blog-cloudflare/src/styles/theme.cssstill lacks the rule. Either apply the same addition there or run./scripts/sync-cloudflare-templates.shso the checked-in Cloudflare template is actually fixed, as the PR description implies.
|
|
||
| /* Keep the signed-in Admin link separated from the primary navigation. */ | ||
| .nav-admin { | ||
| margin-inline-start: var(--spacing-5); |
There was a problem hiding this comment.
[needs fixing] The new .nav-admin declaration is indented with two spaces, but the project convention (and .oxfmtrc.json / .prettierrc) is tabs. The whole file is currently spaces, so run pnpm format to convert it rather than committing more space-indented CSS.
| margin-inline-start: var(--spacing-5); | |
| .nav-admin { | |
| margin-inline-start: var(--spacing-5); | |
| } |
| } | ||
|
|
||
| /* Keep the signed-in Admin link separated from the primary navigation. */ | ||
| .nav-admin { |
There was a problem hiding this comment.
[suggestion] This fixes templates/blog, but templates/blog-cloudflare/src/styles/theme.css still has no .nav-admin spacing rule at the PR head. Since the description says the change should flow to the Cloudflare template, either run ./scripts/sync-cloudflare-templates.sh now or apply the same .nav-admin { margin-inline-start: var(--spacing-5); } addition to templates/blog-cloudflare/src/styles/theme.css so the checked-in variant isn't left with the original spacing bug.
|
I have read the CLA Document and I hereby sign the CLA |
Use the repository’s tab-based indentation for the Admin navigation spacing rule.
Apply the same Admin navigation spacing rule to the Cloudflare blog template as requested by the PR review.
Apply the same Admin navigation spacing rule to the Cloudflare blog template as requested by the PR review.
Format the Admin navigation spacing rule with the repository-standard tab indentation in both blog theme.css files. No behavior change.
Match the Cloudflare blog template’s Admin navigation rule to the repository’s tab indentation convention. No behavior change.
Match the Cloudflare blog template’s Admin navigation rule to the repository’s tab indentation convention. No behavior change.
There was a problem hiding this comment.
This is the right minimal CSS fix for the stated layout problem. After the previous round, both blocking issues are resolved:
- The
.nav-adminspacing rule is now added to bothtemplates/blog/src/styles/theme.cssandtemplates/blog-cloudflare/src/styles/theme.css. - The indentation in the new CSS now uses tabs, matching project style.
- The mobile layout is preserved because both
Base.astrofiles reset.nav-admin { margin-inline-start: 0; }in themax-width: 640pxmedia query. - The property (
margin-inline-start) is RTL-safe, and--spacing-5is defined intokens.css.
Templates are listed in .changeset/config.json "ignore", so no changeset is needed for this CSS-only template change, and no Lingui strings are affected.
One small consistency issue remains: the Cloudflare theme.css is missing the explanatory comment that was added above the rule in the base blog theme.css. Since these files are kept in lockstep by scripts/sync-cloudflare-templates.sh, they should be identical; running the sync script now would re-dirty the Cloudflare file by adding that comment. I left a suggestion to add it.
I did not run the linters, type checker, or tests; the spacing fix is visually verified from the file contents only.
| :root { | ||
| } | ||
|
|
||
| .nav-admin { |
There was a problem hiding this comment.
[suggestion] The Cloudflare variant now includes the .nav-admin spacing rule, but it's missing the explanatory comment that exists in the base blog template (templates/blog/src/styles/theme.css). Because these files are kept in sync by scripts/sync-cloudflare-templates.sh, they should be identical; running that script would add this comment and create unrelated future diff noise. Add the matching comment so both templates stay in lockstep.
| .nav-admin { | |
| /* Keep the signed-in Admin link separated from the primary navigation. */ | |
| .nav-admin { |
|
Thanks |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
The Admin link currently renders directly after the final navigation item as
PostsAdmin.This adds spacing before the Admin link in the blog template while preserving the existing mobile layout.
The change is made in
theme.cssso it can flow to the Cloudflare template through the normal template sync.What does this PR do?
Fixes the blog template navigation so the signed-in Admin link no longer renders directly after the final menu item as PostsAdmin.
Adds spacing through theme.css while preserving the existing mobile layout. The change can flow to the Cloudflare template through the normal template sync.
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runAI-generated code disclosure