Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing nx- class prefixes in blog, fix callout padding in docs #941

Merged
merged 1 commit into from
Oct 27, 2022
Merged
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
8 changes: 8 additions & 0 deletions .changeset/fair-feet-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'nextra': patch
'nextra-theme-docs': patch
'nextra-theme-blog': patch
---

missing `nx-` class prefixes in blog
fix callout padding in docs
2 changes: 1 addition & 1 deletion examples/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "next dev",
"dev": "next",
"build": "next build",
"start": "next start",
"debug": "NODE_OPTIONS='--inspect' next dev",
Expand Down
4 changes: 2 additions & 2 deletions examples/swr-site/pages/index.en-US.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ The name “SWR” is derived from `stale-while-revalidate`, a HTTP cache invali
SWR is a strategy to first return the data from cache (stale), then send the fetch request (revalidate), and finally come with the up-to-date data.

<Callout emoji="✅">
With SWR, components will get a stream of data updates <strong>constantly</strong> and <strong>automatically</strong>.<br/>
And the UI will be always <strong>fast</strong> and <strong>reactive</strong>.
With SWR, components will get a stream of data updates **constantly** and **automatically**.<br/>
And the UI will be always **fast** and **reactive**.
</Callout>

<div className="mt-16 mb-20 text-center">
Expand Down
5 changes: 4 additions & 1 deletion packages/nextra-theme-blog/src/basic-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ export const BasicLayout = ({ children }: { children: ReactNode }) => {
const title = `${opts.title}${config.titleSuffix || ''}`
const ref = useRef<HTMLHeadingElement>(null)
return (
<article className="container prose prose-sm dark:prose-dark md:prose">
<article
className="container nx-prose nx-prose-sm dark:nx-prose-dark md:nx-prose"
dir="ltr"
>
<Head>
<title>{title}</title>
{config.head?.({ title, meta: opts.frontMatter })}
Expand Down
2 changes: 1 addition & 1 deletion packages/nextra-theme-blog/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const BlogLayout = ({
const Layout = layoutMap[type]
if (!Layout) {
throw new Error(
`Nextra-themes-blog does not support the layout type "${type}" It only supports "post", "page", "posts" and "tag"`
`nextra-theme-blog does not support the layout type "${type}" It only supports "post", "page", "posts" and "tag"`
)
}
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/nextra-theme-blog/src/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function Nav(): ReactElement {
const { navPages } = collectPostsAndNavs({ opts, config })
return (
<div className="nx-mb-8 nx-flex nx-items-center nx-gap-3">
<div className="nx-flex grow nx-flex-wrap nx-items-center nx-justify-end nx-gap-3">
<div className="nx-flex nx-grow nx-flex-wrap nx-items-center nx-justify-end nx-gap-3">
{navPages.map(page => {
if (page.active) {
return (
Expand Down
8 changes: 4 additions & 4 deletions packages/nextra-theme-blog/src/posts-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ export const PostsLayout = ({ children }: { children: ReactNode }) => {
<div key={post.route} className="post-item">
<h3>
<Link href={post.route} passHref>
<a className="!no-underline">{postTitle}</a>
<a className="!nx-no-underline">{postTitle}</a>
</Link>
</h3>
{description && (
<p className="mb-2 text-gray-400">
<p className="nx-mb-2 nx-text-gray-400">
{description}
{config.readMore && (
<Link href={post.route} passHref>
<a className="post-item-more ml-2">{config.readMore}</a>
<a className="post-item-more nx-ml-2">{config.readMore}</a>
</Link>
)}
</p>
)}
{date && (
<time className="text-sm text-gray-300" dateTime={date.toISOString()}>
<time className="nx-text-sm nx-text-gray-300" dateTime={date.toISOString()}>
{date.toDateString()}
</time>
)}
Expand Down
2 changes: 1 addition & 1 deletion packages/nextra-theme-blog/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ h1 {
letter-spacing: -0.03em;
}

.prose code {
.nx-prose code {
&:before,
&:after {
@apply nx-hidden;
Expand Down
2 changes: 1 addition & 1 deletion packages/nextra-theme-blog/src/theme-switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function ThemeSwitch() {
<span
role="button"
aria-label="Toggle Dark Mode"
className="cursor-pointer p-2 text-current"
className="nx-cursor-pointer nx-p-2 nx-text-current"
tabIndex={0}
onClick={toggleTheme}
onKeyDown={e => {
Expand Down
2 changes: 1 addition & 1 deletion packages/nextra-theme-docs/src/components/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function Tab({
...props
}: ComponentProps<'div'>): ReactElement {
return (
<HeadlessTab.Panel {...props} className="nx-rounded">
<HeadlessTab.Panel {...props} className="nx-rounded nx-pt-6">
{children}
</HeadlessTab.Panel>
)
Expand Down
18 changes: 12 additions & 6 deletions packages/nextra-theme-docs/src/mdx-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const Details = ({

return (
<details
className="nx-my-4 nx-rounded nx-border nx-border-gray-200 nx-bg-white nx-p-2 nx-shadow-sm dark:nx-border-neutral-800 dark:nx-bg-neutral-900"
className="nx-my-4 nx-rounded nx-border nx-border-gray-200 nx-bg-white nx-p-2 nx-shadow-sm dark:nx-border-neutral-800 dark:nx-bg-neutral-900 first:nx-mt-0"
{...props}
open={delayedOpenState}
{...(openState && { 'data-expanded': true })}
Expand Down Expand Up @@ -238,11 +238,14 @@ export const getComponents = ({
h5: createHeaderLink('h5', context),
h6: createHeaderLink('h6', context),
ul: (props: ComponentProps<'ul'>) => (
<ul className="ltr:nx-ml-6 rtl:nx-mr-6 nx-mt-6 nx-list-disc" {...props} />
<ul
className="ltr:nx-ml-6 rtl:nx-mr-6 nx-mt-6 nx-list-disc first:nx-mt-0"
{...props}
/>
),
ol: (props: ComponentProps<'ol'>) => (
<ol
className="ltr:nx-ml-6 rtl:nx-mr-6 nx-mt-6 nx-list-decimal"
className="ltr:nx-ml-6 rtl:nx-mr-6 nx-mt-6 nx-list-decimal first:nx-mt-0"
{...props}
/>
),
Expand All @@ -251,7 +254,7 @@ export const getComponents = ({
<blockquote
className={cn(
'nx-mt-6 nx-border-gray-300 nx-italic nx-text-gray-700 dark:nx-border-gray-700 dark:nx-text-gray-400',
'rtl:nx-border-r-2 rtl:nx-pr-6 ltr:nx-border-l-2 ltr:nx-pl-6'
'rtl:nx-border-r-2 rtl:nx-pr-6 ltr:nx-border-l-2 ltr:nx-pl-6 first:nx-mt-0'
)}
{...props}
/>
Expand All @@ -266,10 +269,13 @@ export const getComponents = ({
/>
),
table: (props: ComponentProps<'table'>) => (
<Table className="nextra-scrollbar nx-mt-6 nx-p-0" {...props} />
<Table
className="nextra-scrollbar nx-mt-6 nx-p-0 first:nx-mt-0"
{...props}
/>
),
p: (props: ComponentProps<'p'>) => (
<p className="nx-mt-6 nx-leading-7" {...props} />
<p className="nx-mt-6 nx-leading-7 first:nx-mt-0" {...props} />
),
tr: Tr,
th: Th,
Expand Down
2 changes: 1 addition & 1 deletion packages/nextra/src/components/pre.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const Pre = ({
)}
<pre
className={[
'nx-bg-primary-700/5 nx-mt-6 nx-mb-4 nx-overflow-x-auto nx-rounded-xl nx-font-medium nx-subpixel-antialiased dark:nx-bg-primary-300/10',
'nx-bg-primary-700/5 nx-mb-4 nx-overflow-x-auto nx-rounded-xl nx-font-medium nx-subpixel-antialiased dark:nx-bg-primary-300/10',
'contrast-more:nx-border contrast-more:nx-border-primary-900/20 contrast-more:nx-contrast-150 contrast-more:dark:nx-border-primary-100/40',
filename ? 'nx-pt-12 nx-pb-4' : 'nx-py-4',
className
Expand Down
2 changes: 1 addition & 1 deletion packages/nextra/styles/code-block.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pre {
}

[data-rehype-pretty-code-fragment] {
@apply nx-relative;
@apply nx-relative nx-mt-6 first:nx-mt-0;
}

@supports (
Expand Down
7 changes: 6 additions & 1 deletion packages/nextra/styles/subheading-anchor.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@

span:target + &,
:hover > & {
@apply nx-no-underline nx-opacity-100;
@apply nx-opacity-100;
}

span + &,
:hover > & {
@apply !nx-no-underline;
}

&:after {
Expand Down