Skip to content

Commit

Permalink
fix: some ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Innei committed Jul 25, 2023
1 parent 95bde28 commit fcc07ec
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 24 deletions.
3 changes: 2 additions & 1 deletion src/app/notes/[id]/page.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
.paragraph .indent {
border-bottom: 1px solid;

@apply border-accent/20 dark:border-accent/30;
/* @apply border-accent/20 dark:border-accent/20; */
@apply border-accent/10;
}

blockquote {
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/header/internal/SiteOwnerAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export const SiteOwnerAvatar: Component = ({ className }) => {
width={40}
height={40}
className={clsxm(
'rounded-md ring-2 ring-slate-200 dark:ring-neutral-800',
isLiving ? 'rounded-full' : '',
'ring-2 ring-slate-200 dark:ring-neutral-800',
isLiving ? 'rounded-full' : 'mask mask-squircle',
)}
/>
{isLiving && (
Expand Down
14 changes: 7 additions & 7 deletions src/components/ui/image/ZoomedImage.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
}

.loaded {
animation: zoomIn 500ms ease-in-out forwards;
animation: imageLoad 500ms ease-in-out forwards;
}

@keyframes zoomIn {
@keyframes imageLoad {
0% {
opacity: 0;
clip-path: inset(5%);
transform: scale(111.11%);
mask: linear-gradient(90deg, #000 25%, #000000e6 50%, #00000000) 150% 0 /
400% no-repeat;
opacity: 0.2;
}
100% {
mask: linear-gradient(90deg, #000 25%, #000000e6 50%, #00000000) 0 / 400%
no-repeat;
opacity: 1;
clip-path: inset(0);
transform: scale(1);
}
}
9 changes: 8 additions & 1 deletion src/components/ui/markdown/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ import { KateXRule } from './parsers/katex'
import { MarkRule } from './parsers/mark'
import { MentionRule } from './parsers/mention'
import { SpoilderRule } from './parsers/spoiler'
import { MParagraph, MTableBody, MTableHead, MTableRow } from './renderers'
import {
MParagraph,
MTable,
MTableBody,
MTableHead,
MTableRow,
} from './renderers'
import { MDetails } from './renderers/collapse'
import { MFootNote } from './renderers/footnotes'
import { MHeader } from './renderers/heading'
Expand Down Expand Up @@ -79,6 +85,7 @@ export const Markdown: FC<MdProps & MarkdownToJSX.Options & PropsWithChildren> =
thead: MTableHead,
tr: MTableRow,
tbody: MTableBody,
table: MTable,
// FIXME: footer tag in raw html will renders not as expected, but footer tag in this markdown lib will wrapper as linkReferer footnotes
footer: MFootNote,
details: MDetails,
Expand Down
18 changes: 11 additions & 7 deletions src/components/ui/markdown/renderers/LinkRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,17 @@ const FixedRatioContainer = ({
children: React.ReactNode
}) => {
return (
<div
className="relative my-8 h-0 w-full"
style={{
paddingBottom: `${ratio}%`,
}}
>
{children}
<div className="mockup-window my-16 bg-base-300">
<div className="flex justify-center px-4">
<div
className="relative my-8 h-0 w-full"
style={{
paddingBottom: `${ratio}%`,
}}
>
{children}
</div>
</div>
</div>
)
}
15 changes: 13 additions & 2 deletions src/components/ui/markdown/renderers/table.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
import React from 'react'
import clsx from 'clsx'
import type { FC } from 'react'

import { clsxm } from '~/lib/helper'

export const MTable: FC<JSX.IntrinsicElements['table']> = (props) => {
const { className, ...rest } = props
return (
<table
{...rest}
className={clsxm('table table-zebra table-pin-rows', className)}
/>
)
}

export const MTableHead: FC<JSX.IntrinsicElements['thead']> = (props) => {
const { children, className, ...rest } = props
return (
<thead className={clsx(className, 'bg-base-content/20')} {...rest}>
<thead className={className} {...rest}>
{children}
</thead>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { FC } from 'react'

import { useUser } from '@clerk/nextjs'

import { useIsLogged } from '~/atoms'
import { MotionButtonBase } from '~/components/ui/button'
import { FloatPopover } from '~/components/ui/float-popover'

Expand Down Expand Up @@ -39,6 +40,9 @@ export const SwitchCommentMode = () => {
</>
)
}).current

const isOwnerLogged = useIsLogged()
if (isOwnerLogged) return null
return (
<MotionButtonBase
className={clsx(
Expand Down
12 changes: 9 additions & 3 deletions src/styles/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
}

.animation-blink {
animation: blink 2s ease infinite both;
animation: blink 1.2s linear infinite;
}

.mask-top {
Expand All @@ -107,12 +107,18 @@
0% {
opacity: 0;
}
50% {
40% {
opacity: 0;
}
40.1% {
opacity: 1;
}
100% {
99.9% {
opacity: 1;
}
100% {
opacity: 0;
}
}
}

Expand Down
7 changes: 7 additions & 0 deletions storybook/mock-packages/next_navigation/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const useRouter = () => {
return {
push(path) {
location.pathname = path
},
}
}
4 changes: 4 additions & 0 deletions storybook/mock-packages/next_navigation/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "next_navigation",
"main": "./index.js"
}
1 change: 1 addition & 0 deletions storybook/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default defineConfig({
'next/image': resolve(__dirname, './mock-packages/next_image'),
'next/link': resolve(__dirname, './mock-packages/next_link'),
'next/dynamic': resolve(__dirname, './mock-packages/next_dynamic'),
'next/navigation': resolve(__dirname, './mock-packages/next_navigation'),
'~': resolve(__dirname, '../src'),
},
},
Expand Down
3 changes: 2 additions & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,9 @@ const twConfig: Config = {
addDynamicIconSelectors(),
addShortcutPlugin,

daisyui,
typography,
daisyui,

require('tailwind-scrollbar'),
],
}
Expand Down

1 comment on commit fcc07ec

@vercel
Copy link

@vercel vercel bot commented on fcc07ec Jul 25, 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 – ./

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

Please sign in to comment.