Skip to content

Commit

Permalink
Fixes for release 0.2.4 (#104)
Browse files Browse the repository at this point in the history
* fix naming of `HeaderTitle` story

* use custom `min-h` values for `HeaderArea` styles

* allow to use `ReactNode` for `HeaderBackWithoutAction`'s `title`

* do not use `React.FC` for header components
  • Loading branch information
lukasvice authored Aug 22, 2022
1 parent ac59398 commit 3fc60b1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
10 changes: 6 additions & 4 deletions src/components/header/HeaderBackWithoutAction.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ReactElement, ReactNode } from 'react'
import { useRouter } from '../../framework'
import { HeaderArea } from './areas/HeaderArea'
import { HeaderBackAction } from './actions/HeaderBackAction'
Expand All @@ -7,15 +8,18 @@ type Props = {
/**
* Define a header title.
**/
title: string
title: ReactNode

/**
* Override default onBack action.
**/
onBack?: () => void
}

const HeaderBackWithoutAction: React.FC<Props> = ({ title, onBack }) => {
export function HeaderBackWithoutAction({
title,
onBack,
}: Props): ReactElement {
const router = useRouter()

return (
Expand All @@ -25,5 +29,3 @@ const HeaderBackWithoutAction: React.FC<Props> = ({ title, onBack }) => {
</HeaderArea>
)
}

export { HeaderBackWithoutAction }
8 changes: 4 additions & 4 deletions src/components/header/areas/HeaderLeftArea.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ReactElement, ReactNode } from 'react'
import { useTheme } from '../../../framework'
import { ClassNameProps } from '../../types'

type Props = ClassNameProps
type Props = ClassNameProps & { children?: ReactNode }

const HeaderLeftArea: React.FC<Props> = ({ className, children }) => {
export function HeaderLeftArea({ className, children }: Props): ReactElement {
const { header } = useTheme()

return (
<div className={className}>
<div className={header.leftArea.base}>{children}</div>
</div>
)
}

export { HeaderLeftArea }
8 changes: 4 additions & 4 deletions src/components/header/areas/HeaderRightArea.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ReactElement, ReactNode } from 'react'
import { useTheme } from '../../../framework'
import { ClassNameProps } from '../../types'

type Props = ClassNameProps
type Props = ClassNameProps & { children?: ReactNode }

const HeaderRightArea: React.FC<Props> = ({ className, children }) => {
export function HeaderRightArea({ className, children }: Props): ReactElement {
const { header } = useTheme()

return (
<div className={className}>
<div className={header.rightArea.base}>{children}</div>
</div>
)
}

export { HeaderRightArea }
2 changes: 1 addition & 1 deletion src/components/header/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
desktop: 'hidden lg:inline-block',
},
area: {
base: 'mb-6 flex min-h-10 items-center lg:min-h-15',
base: 'mb-6 flex min-h-[2.5rem] items-center lg:min-h-[3.75rem]',
},
leftArea: {
base: 'flex items-center mr-2 lg:mr-3 space-x-3 lg:space-x-4',
Expand Down

0 comments on commit 3fc60b1

Please sign in to comment.