feat(brand): render brandName from runtime config
This commit is contained in:
1 parent
cc5f4d077a
commit
90d398656c
2 files changed
+25
-2
No files matched your search
@@ -1,3 +1,11 @@
|
||||
export default function Brand() {
|
||||
return <div>Brand placeholder</div>
|
||||
import { useConfig } from '@/app/providers/ConfigProvider'
|
||||
|
||||
export default function Brand({ size = 'md' }: { size?: 'sm' | 'md' | 'lg' }) {
|
||||
const cfg = useConfig()
|
||||
const cls = size === 'lg' ? 'text-3xl' : size === 'sm' ? 'text-base' : 'text-xl'
|
||||
return (
|
||||
<span className={`font-serif font-semibold tracking-tight ${cls}`}>
|
||||
{cfg.brandName}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { ConfigProvider } from '@/app/providers/ConfigProvider'
|
||||
import Brand from '@/components/brand/Brand'
|
||||
|
||||
describe('Brand', () => {
|
||||
it('renders the brand name from config', () => {
|
||||
render(
|
||||
<ConfigProvider>
|
||||
<Brand />
|
||||
</ConfigProvider>,
|
||||
)
|
||||
expect(screen.getByText(/Osteo Report/i)).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user