Skip to content

Commit

Permalink
fix: image margin
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Jun 24, 2023
1 parent 0013b17 commit f8902a6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/ui/image/ZoomedImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { LazyLoad } from '~/components/common/Lazyload'
import { useIsUnMounted } from '~/hooks/common/use-is-unmounted'
import { calculateDimensions } from '~/lib/calc-image'
import { useMarkdownImageRecord } from '~/providers/article/MarkdownImageRecordProvider'
import { isDev } from '~/utils/env'
import { clsxm } from '~/utils/helper'

import { Divider } from '../divider'
Expand Down Expand Up @@ -77,7 +78,6 @@ export const ImageLazy: Component<TImageProps & BaseImageProps> = ({
},
[isUnmount],
)

const imageRef = useRef<HTMLImageElement>(null)
useEffect(() => {
if (imageLoadStatus !== ImageLoadStatus.Loaded) {
Expand All @@ -99,11 +99,12 @@ export const ImageLazy: Component<TImageProps & BaseImageProps> = ({

return (
<LazyLoad placeholder={placeholder} offset={30}>
<figure suppressHydrationWarning>
<figure>
<span className="relative flex justify-center">
<span>
{imageLoadStatus !== ImageLoadStatus.Loaded && placeholder}
</span>

<img
src={src}
title={title}
Expand Down Expand Up @@ -196,7 +197,7 @@ const Placeholder: FC<

return (
<span
className={styles.base}
className={`image-placeholder ${styles.base}`}
data-width={scaledSize.scaleWidth}
data-height={scaledSize.scaleHeight}
data-from-record-height={imageMeta?.height}
Expand All @@ -215,11 +216,13 @@ const NoFixedPlaceholder = ({ accent }: { accent?: string }) => {
return (
<span
className={clsxm(
'image-placeholder',
styles.base,
'h-[300px] w-full bg-slate-300 dark:bg-slate-700',
)}
style={{
backgroundColor: accent,
outline: isDev ? '4px solid red' : undefined,
}}
/>
)
Expand Down
9 changes: 9 additions & 0 deletions src/providers/post/CurrentPostDataProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import type { PostModel } from '@mx-space/api-client'

import { isClientSide, isDev } from '~/utils/env'

import { createDataProvider } from '../internal/createDataProvider'

const {
Expand All @@ -11,6 +13,13 @@ const {
useCurrentDataSelector,
} = createDataProvider<PostModel>()

declare global {
interface Window {
getCurrentPostData: typeof getCurrentData
}
}
if (isDev && isClientSide) window.getCurrentPostData = getCurrentData

export {
CurrentDataProvider as CurrentPostDataProvider,
getCurrentData as getCurrentPostData,
Expand Down
7 changes: 7 additions & 0 deletions src/styles/tailwindcss.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit f8902a6

@vercel
Copy link

@vercel vercel bot commented on f8902a6 Jun 24, 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:

springtide – ./

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

Please sign in to comment.