Skip to content

Commit

Permalink
feat: improve print mode
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Jul 6, 2023
1 parent 8b8dede commit f37a427
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 13 deletions.
12 changes: 5 additions & 7 deletions global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ declare global {
updateCallbackDone: () => void
skipTransition(): void
}
}

declare module 'react' {
export interface HTMLAttributes<T>
extends AriaAttributes,
DOMAttributes<T> {
'data-hide-print'?: boolean
'data-testid'?: string
}
declare module 'react' {
export interface AriaAttributes {
'data-hide-print'?: boolean
'data-testid'?: string
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/app/(page-detail)/[slug]/pageExtra.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ export const PagePaginator = () => {
const hasNext = indexInPages + 1 < n
const hasPrev = indexInPages - 1 >= 0
return (
<div className="relative mt-8 grid h-20 select-none grid-cols-2">
<div
className="relative mt-8 grid h-20 select-none grid-cols-2"
data-hide-print
>
<div className="justify-start">
{hasPrev && (
<Fragment>
Expand Down
4 changes: 3 additions & 1 deletion src/components/common/Lazyload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export const LazyLoad: FC<PropsWithChildren & LazyLoadProps> = (props) => {

return (
<>
{!isLoaded && <span data-testid="lazyload-indicator" ref={ref} />}
{!isLoaded && (
<span data-hide-print data-testid="lazyload-indicator" ref={ref} />
)}
{!inView ? placeholder : props.children}
</>
)
Expand Down
5 changes: 4 additions & 1 deletion src/components/layout/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { FooterInfo } from './FooterInfo'

export const Footer = () => {
return (
<footer className="relative z-[1] mt-32 border-t border-x-uk-separator-opaque-light bg-slate-50 py-6 text-base-content/80 dark:border-uk-separator-opaque-dark dark:bg-neutral-900">
<footer
data-hide-print
className="relative z-[1] mt-32 border-t border-x-uk-separator-opaque-light bg-slate-50 py-6 text-base-content/80 dark:border-uk-separator-opaque-dark dark:bg-neutral-900"
>
<div className="px-4 sm:px-8">
<div className="relative mx-auto max-w-7xl lg:px-8">
<FooterInfo />
Expand Down
1 change: 1 addition & 0 deletions src/components/layout/header/internal/HeaderWithShadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const HeaderWithShadow: Component = ({ children }) => {
)
return (
<header
data-hide-print
className={clsx(
'fixed left-0 right-0 top-0 z-[9] h-[4.5rem] overflow-hidden transition-shadow duration-200',
showShadow &&
Expand Down
1 change: 1 addition & 0 deletions src/components/ui/loading/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const Loading: Component<LoadingProps> = ({
: loadingText
return (
<div
data-hide-print
className={clsxm(
'my-20 flex flex-col items-center justify-start',
className,
Expand Down
2 changes: 1 addition & 1 deletion src/components/widgets/comment/CommentBox/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const CommentBoxRoot: FC<CommentBaseProps> = (props) => {

return (
<CommentBoxProvider refId={refId}>
<div className="group relative w-full min-w-0">
<div className="group relative w-full min-w-0" data-hide-print>
<SwitchCommentMode />

<div className="relative w-full">
Expand Down
5 changes: 4 additions & 1 deletion src/components/widgets/subscribe/SubscribeBell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ export const SubscribeBell: FC<SubscribeBellProps> = (props) => {
}

return (
<div className="mb-6 flex flex-col items-center justify-center p-4">
<div
className="mb-6 flex flex-col items-center justify-center p-4"
data-hide-print
>
<p className="text-gray-1 leading-8 opacity-80">
站点已开启邮件订阅,点亮小铃铛,订阅最新文章哦~
</p>
Expand Down
5 changes: 4 additions & 1 deletion src/components/widgets/xlog/XLogInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ const XLogInfoBase: FC<{
}

return (
<div className="my-6 select-none text-sm [&_h4]:font-medium [&_section]:my-2">
<div
className="my-6 select-none text-sm [&_h4]:font-medium [&_section]:my-2"
data-hide-print
>
<div
role="button"
tabIndex={0}
Expand Down
1 change: 1 addition & 0 deletions src/components/widgets/xlog/XLogSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const XLogSummary: FC<{

let Inner: ReactNode = (
<div
data-hide-print
className={clsxm(
`space-y-2 rounded-xl border border-slate-200 p-4 dark:border-neutral-800`,
props.className,
Expand Down

1 comment on commit f37a427

@vercel
Copy link

@vercel vercel bot commented on f37a427 Jul 6, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

shiro – ./

springtide.vercel.app
shiro-innei.vercel.app
shiro-git-main-innei.vercel.app
innei.in

Please sign in to comment.