Skip to content

Commit

Permalink
accessibility issues in light mode (#1903)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru>
Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
Co-authored-by: Khang <brew4k@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tristan <tristandubbeld@users.noreply.github.com>
Co-authored-by: Brian Muenzenmeyer <Brian.Muenzenmeyer@target.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: AkaraChen <85140972+AkaraChen@users.noreply.github.com>
  • Loading branch information
10 people authored Jun 19, 2023
1 parent 6c12bf4 commit bef7324
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/little-mirrors-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'nextra-theme-blog': patch
---

accessibility issues for text and navbar in light mode
2 changes: 1 addition & 1 deletion packages/nextra-theme-blog/src/meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function Meta(): ReactElement {
(readingTime ? 'nx-items-start' : 'nx-items-center')
}
>
<div className="nx-grow nx-text-gray-400">
<div className="nx-grow dark:nx-text-gray-400 nx-text-gray-600">
<div className="nx-not-prose nx-flex nx-flex-wrap nx-items-center nx-gap-1">
{author}
{author && date && ','}
Expand Down
9 changes: 2 additions & 7 deletions packages/nextra-theme-blog/src/nav.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useTheme } from 'next-themes'
import Link from 'next/link'
import type { ReactElement } from 'react'
import { useBlogContext } from './blog-context'
Expand All @@ -8,7 +7,7 @@ import { collectPostsAndNavs } from './utils/collect'
export default function Nav(): ReactElement {
const { opts, config } = useBlogContext()
const { navPages } = collectPostsAndNavs({ opts, config })
const { resolvedTheme } = useTheme()

return (
<div className="nx-mb-8 nx-flex nx-items-center nx-gap-3">
<div className="nx-flex nx-grow nx-flex-wrap nx-items-center nx-justify-end nx-gap-3">
Expand All @@ -18,11 +17,7 @@ export default function Nav(): ReactElement {
return (
<span
key={page.route}
className={`nx-cursor-default ${
resolvedTheme === 'dark'
? 'nx-text-gray-400'
: 'nx-text-gray-600'
}`}
className="nx-cursor-default dark:nx-text-gray-400 nx-text-gray-600"
>
{name}
</span>
Expand Down
9 changes: 3 additions & 6 deletions packages/nextra-theme-blog/src/posts-layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useTheme } from 'next-themes'
import Link from 'next/link'
import { useRouter } from 'next/router'
import type { ReactElement, ReactNode } from 'react'
Expand All @@ -19,9 +18,7 @@ export const PostsLayout = ({
const router = useRouter()
const { type } = opts.frontMatter
const tagName = type === 'tag' ? router.query.tag : null
const { resolvedTheme } = useTheme()
const textColor =
resolvedTheme === 'dark' ? 'nx-text-gray-400' : 'nx-text-gray-600'

const postList = posts.map(post => {
if (tagName) {
const tags = getTags(post)
Expand All @@ -46,7 +43,7 @@ export const PostsLayout = ({
</Link>
</h3>
{description && (
<p className={'nx-mb-2 ' + textColor}>
<p className="nx-mb-2 dark:nx-text-gray-400 nx-text-gray-600">
{description}
{config.readMore && (
<Link href={post.route} passHref legacyBehavior>
Expand All @@ -57,7 +54,7 @@ export const PostsLayout = ({
)}
{date && (
<time
className={'nx-text-sm ' + textColor}
className="nx-text-sm dark:nx-text-gray-400 nx-text-gray-600"
dateTime={date.toISOString()}
>
{date.toDateString()}
Expand Down

1 comment on commit bef7324

@vercel
Copy link

@vercel vercel bot commented on bef7324 Jun 19, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.