Skip to content

Commit

Permalink
update: iconStyle, lint
Browse files Browse the repository at this point in the history
  • Loading branch information
aolyang committed Dec 29, 2024
1 parent a24b750 commit 0e5bca3
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 33 deletions.
2 changes: 1 addition & 1 deletion docs/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const eslintConfig = [
`node:`,
`^(${builtinModules.join("|")})(/|$)`
],
["^@?\\w"],
["^@?\\w.*\\u0000$", "^[^.].*\\u0000$", "^\\..*\\u0000$"],
["^"],
["^\\."]
]
Expand Down
5 changes: 2 additions & 3 deletions docs/src/app/[lang]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import "@/styles/tailwind.css"
import type { Metadata } from "next"
import type { ReactNode } from "react"

import ClientThemeProvider from "@/components/ClientThemeProvider"
import { i18n } from "@/utils/i18n"
import { AppRouterCacheProvider } from "@mui/material-nextjs/v15-appRouter"
import { Head } from "nextra/components"
import { getPageMap } from "nextra/page-map"
import { Footer, LastUpdated, Layout, LocaleSwitch, Navbar, ThemeSwitch } from "nextra-theme-docs"

import ClientThemeProvider from "@/components/ClientThemeProvider"
import { i18n } from "@/utils/i18n"

export const { viewport } = Head

export const metadata: Metadata = {
Expand Down
3 changes: 1 addition & 2 deletions docs/src/components/ClientThemeProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"use client"
import type { ReactNode } from "react"

import { CssBaseline, ThemeProvider } from "@mui/material"

import theme from "@/utils/theme"
import { CssBaseline, ThemeProvider } from "@mui/material"

export default function ClientThemeProvider({ children }: { children: ReactNode }) {
return (
Expand Down
11 changes: 6 additions & 5 deletions docs/src/components/IconBar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { ButtonProps } from "@mui/material"
import type { AriaAttributes, CSSProperties, RefObject } from "react"

import { Icon } from "@mdi/react"
import type { IconButtonProps } from "@mui/material"
import { IconButton, Tooltip } from "@mui/material"
import { Button, Tooltip } from "@mui/material"

export interface HTMLProps extends AriaAttributes {
className?: string
Expand All @@ -23,7 +23,8 @@ export interface IconProps extends HTMLProps {
style?: CSSProperties
inStack?: boolean
}
export interface IconBarProps extends IconButtonProps {

export interface IconBarProps extends ButtonProps {
path: string
tooltip?: string
disabled?: boolean
Expand All @@ -34,9 +35,9 @@ export interface IconBarProps extends IconButtonProps {
export default function IconBar({ tooltip, iconProps, path, ...btnProps }: IconBarProps) {
return (
<Tooltip title={tooltip}>
<IconButton size="small" {...btnProps}>
<Button className="size-7 min-w-7 p-0 rounded-[2px]" variant="text" color="inherit" size="small" {...btnProps}>
<Icon size={0.8} path={path} {...iconProps} />
</IconButton>
</Button>
</Tooltip>
)
}
5 changes: 2 additions & 3 deletions docs/src/components/PlainTextSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import type { ReactNode } from "react"

import useMenuTrigger from "@/hooks/useMenuTrigger"
import { mdiMenuDown } from "@mdi/js"
import { Icon } from "@mdi/react"
import { ButtonBase, ClickAwayListener, Menu, MenuItem, MenuList } from "@mui/material"
import cn from "clsx"
import React, { useState } from "react"

import useMenuTrigger from "@/hooks/useMenuTrigger"

interface PlainTextSelectProps<T> {
className?: string
items: T[]
Expand All @@ -27,7 +26,7 @@ export default function PlainTextSelect<T>(
return (
<>
<ButtonBase
className={cn("bar-menu-selector px-1", className)}
className={cn("bar-menu-selector px-1 rounded-[2px]", className)}
onClick={handleClick}
>
{renderLabel(value)}
Expand Down
3 changes: 1 addition & 2 deletions docs/src/components/editor-toolbars/FontSizeMinus.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ediFontSizeMinus } from "@tiptiz/editor-icons"

import IconBar from "@/components/IconBar"
import { ediFontSizeMinus } from "@tiptiz/editor-icons"

export default function FontSizeMinus() {
return <IconBar tooltip="Font Size Decrease" path={ediFontSizeMinus} />
Expand Down
3 changes: 1 addition & 2 deletions docs/src/components/editor-toolbars/FontSizePus.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ediFontSizePlus } from "@tiptiz/editor-icons"

import IconBar from "@/components/IconBar"
import { ediFontSizePlus } from "@tiptiz/editor-icons"

export default function FontSizePus() {
return <IconBar tooltip="Font Size Increase" path={ediFontSizePlus} />
Expand Down
5 changes: 2 additions & 3 deletions docs/src/components/editor-toolbars/FormatBrush.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ediBrush } from "@tiptiz/editor-icons"

import IconBar from "@/components/IconBar"
import { ediBrush } from "@tiptiz/editor-icons"

export default function FormatBrush() {
return <IconBar tooltip="Format Clear" path={ediBrush} />
return <IconBar tooltip="Format Clear" path={ediBrush} iconProps={{ rotate: 180 }} />
}
3 changes: 1 addition & 2 deletions docs/src/components/editor-toolbars/FormatClear.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ediEraser } from "@tiptiz/editor-icons"

import IconBar from "@/components/IconBar"
import { ediEraser } from "@tiptiz/editor-icons"

export default function FormatClear() {
return <IconBar tooltip="Format Clear" path={ediEraser} />
Expand Down
3 changes: 1 addition & 2 deletions docs/src/components/editor-toolbars/HeadingLevel.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import PlainTextSelect from "@/components/PlainTextSelect"
import { Icon } from "@mdi/react"
import { ediHeading1, ediHeading2, ediHeading3, ediHeading4, ediHeading5, ediHeading6 } from "@tiptiz/editor-icons"

import PlainTextSelect from "@/components/PlainTextSelect"

const headings = [
{ tag: "h1", Icon: ediHeading1 },
{ tag: "h2", Icon: ediHeading2 },
Expand Down
3 changes: 1 addition & 2 deletions docs/src/components/editor-toolbars/Redo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ediRedo } from "@tiptiz/editor-icons"

import IconBar from "@/components/IconBar"
import { ediRedo } from "@tiptiz/editor-icons"

export default function Redo() {
return <IconBar tooltip="Redo" path={ediRedo} />
Expand Down
3 changes: 1 addition & 2 deletions docs/src/components/editor-toolbars/Undo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ediUndo } from "@tiptiz/editor-icons"

import IconBar from "@/components/IconBar"
import { ediUndo } from "@tiptiz/editor-icons"

export default function Undo() {
return <IconBar tooltip="Undo" path={ediUndo} />
Expand Down
7 changes: 3 additions & 4 deletions docs/src/components/page-index/ToolbarRich.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"use client"
import "@/styles/toolbars.css"

import cn from "clsx"

import Hr from "@/components/Hr"
import cn from "clsx"

import FontFamily from "../editor-toolbars/FontFamily"
import FontSize from "../editor-toolbars/FontSize"
Expand All @@ -26,13 +25,13 @@ export default function ToolbarRich() {
"bg-neutral-100 dark:bg-neutral-800"
)}
>
<div className="w-15">
<div className="w-14">
<Undo />
<Redo />
<FormatClear />
<FormatBrush />
</div>
<Hr className="h-[80%] mr-3" />
<Hr className="h-[80%] mx-2" />
<div>
<FontFamily />
<FontSize />
Expand Down

0 comments on commit 0e5bca3

Please sign in to comment.