-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: migrate changelog classnames to stylesheet (#1479)
- Loading branch information
1 parent
93417b4
commit 77bd17d
Showing
5 changed files
with
135 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,26 @@ | ||
import { useAtomValue } from "jotai"; | ||
import { ReactElement, ReactNode } from "react"; | ||
import { SIDEBAR_ROOT_NODE_ATOM } from "../atoms"; | ||
import clsx from "clsx"; | ||
import { ComponentPropsWithoutRef, ReactElement, ReactNode } from "react"; | ||
|
||
interface ChangelogContentLayoutProps { | ||
interface ChangelogContentLayoutProps extends ComponentPropsWithoutRef<"div"> { | ||
as: "div" | "section" | "article"; | ||
stickyContent?: ReactNode; | ||
children: ReactNode; | ||
} | ||
|
||
export function ChangelogContentLayout({ children, stickyContent }: ChangelogContentLayoutProps): ReactElement { | ||
const fullWidth = useAtomValue(SIDEBAR_ROOT_NODE_ATOM) == null; | ||
return fullWidth ? ( | ||
<> | ||
<div className="hidden lg:block flex-initial w-64 shrink-0"> | ||
{stickyContent != null && ( | ||
<div className="sticky top-header-offset-padded t-muted text-base mb-8">{stickyContent}</div> | ||
)} | ||
</div> | ||
<div className="mx-auto relative max-w-content-width min-w-0 shrink flex-auto"> | ||
{stickyContent != null && <div className="t-muted text-base mb-8 lg:hidden">{stickyContent}</div>} | ||
{children} | ||
</div> | ||
</> | ||
) : ( | ||
<> | ||
<div className="relative mr-6 max-w-content-width min-w-0 shrink flex-auto"> | ||
{stickyContent != null && <div className="t-muted text-base mb-8 xl:hidden">{stickyContent}</div>} | ||
export function ChangelogContentLayout({ | ||
as: Component, | ||
children, | ||
stickyContent, | ||
...props | ||
}: ChangelogContentLayoutProps): ReactElement { | ||
const asideContent = stickyContent != null && <div className="fern-changelog-date">{stickyContent}</div>; | ||
return ( | ||
<Component {...props} className={clsx("fern-changelog-entry", props.className)}> | ||
<aside>{asideContent}</aside> | ||
<div className="fern-changelog-content"> | ||
{asideContent} | ||
{children} | ||
</div> | ||
{stickyContent != null && ( | ||
<div className="-mt-2 w-72 pl-4 text-right hidden xl:block"> | ||
<span className="t-muted text-base sticky top-header-offset-padded">{stickyContent}</span> | ||
</div> | ||
)} | ||
</> | ||
</Component> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
@layer components { | ||
.fern-changelog { | ||
@apply flex justify-between px-4 md:px-6 lg:px-8; | ||
|
||
> main { | ||
@apply mx-auto max-w-screen-lg break-words; | ||
} | ||
} | ||
|
||
.fern-changelog-entry { | ||
@apply flex items-stretch; | ||
|
||
&:is(article) { | ||
@apply py-8 lg:py-16; | ||
} | ||
} | ||
|
||
.fern-changelog.full-width { | ||
@apply pt-12 lg:pt-24; | ||
|
||
.fern-changelog-content { | ||
@apply mx-auto relative max-w-content-width min-w-0 shrink flex-auto; | ||
|
||
.fern-changelog-date { | ||
@apply t-muted text-base mb-8 lg:hidden; | ||
} | ||
} | ||
|
||
.fern-changelog-entry > aside { | ||
@apply hidden lg:block flex-initial w-64 shrink-0; | ||
|
||
.fern-changelog-date { | ||
@apply sticky top-header-offset-padded t-muted text-base mb-8; | ||
} | ||
} | ||
} | ||
|
||
.fern-changelog:not(.full-width) { | ||
@apply pt-8; | ||
|
||
> main { | ||
@apply lg:ml-8; | ||
} | ||
|
||
.fern-changelog-entry { | ||
@apply flex-row-reverse; | ||
} | ||
|
||
.fern-changelog-content { | ||
@apply relative mr-6 max-w-content-width min-w-0 shrink flex-auto; | ||
|
||
.fern-changelog-date { | ||
@apply t-muted text-base mb-8 xl:hidden; | ||
} | ||
} | ||
|
||
.fern-changelog-entry > aside { | ||
@apply -mt-2 w-72 pl-4 text-right hidden xl:block; | ||
|
||
.fern-changelog-date { | ||
@apply sticky t-muted text-base top-header-offset-padded; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters