hensei-web/components/common/ToolbarButton/index.tsx
Justin Edmund b34cc8a4eb refactor: migrate all components from next-i18next to next-intl
- Update all component imports from useTranslation to useTranslations
- Replace react-i18next and next-i18next imports with next-intl
- Convert Trans components to t.rich() for rich text formatting
- Update all translation hook usage to next-intl API

This affects 80+ component files across the codebase including:
- Character, weapon, summon components
- Auth modals (login, signup, account)
- Party management components
- Filter and search components
- Toast notifications
- About pages and content updates

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 19:48:04 -07:00

41 lines
924 B
TypeScript

import { useTranslations } from 'next-intl'
import classNames from 'classnames'
import { Editor } from '@tiptap/react'
import Tooltip from '~components/common/Tooltip'
import styles from './index.module.scss'
interface Props {
editor: Editor
action: string
level?: number
icon: React.ReactNode
onClick: () => void
}
const ToolbarIcon = ({ editor, action, level, icon, onClick }: Props) => {
const t = useTranslations('common')
const classes = classNames({
[styles.button]: true,
[styles.active]: level
? editor.isActive(action, { level: level })
: editor.isActive(action),
})
return (
<Tooltip
content={
level
? t(`toolbar.tooltips.${action}`, { level: level })
: t(`toolbar.tooltips.${action}`)
}
>
<button onClick={onClick} className={classes}>
{icon}
</button>
</Tooltip>
)
}
export default ToolbarIcon