Skip to content

Commit

Permalink
added ZoomControls component to FormHeader component and amended padd…
Browse files Browse the repository at this point in the history
…ing to accommodate it
  • Loading branch information
r00dgirl committed Feb 19, 2024
1 parent 81f3fcd commit 43af8d6
Showing 1 changed file with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RefObject, useCallback } from 'react'
import { RefObject, useCallback, useEffect, useState } from 'react'
import { BiLogOutCircle } from 'react-icons/bi'
import { Waypoint } from 'react-waypoint'
import {
Expand All @@ -18,6 +18,8 @@ import { noPrintCss } from '~utils/noPrintCss'
import Button from '~components/Button'
import IconButton from '~components/IconButton'

import ZoomControls from '../ZoomControls'

export type MiniHeaderProps = Pick<
FormHeaderProps,
| 'title'
Expand Down Expand Up @@ -142,6 +144,30 @@ export const FormHeader = ({
[onClose, onOpen],
)

const [rootFontSize, setRootFontSize] = useState('16px')

const setDefaultSize = () => {
setRootFontSize('16px')
console.log('set default size!')
}

const setLargeSize = () => {
setRootFontSize('18px')
console.log('set large size!')
}

const setLargestSize = () => {
setRootFontSize('24px')
console.log('set largest size!')
}

useEffect(() => {
const root = document.documentElement
root.style.setProperty('font-size', rootFontSize)
// need to reset on unmount
return () => root.style.removeProperty('font-size')
}, [rootFontSize])

if (!showHeader) return null

return (
Expand All @@ -162,7 +188,8 @@ export const FormHeader = ({
<Flex
transition="background 0.2s ease"
px={{ base: '1.5rem', md: '3rem' }}
py={{ base: '2rem', md: '3rem' }}
pt={{ base: '2rem', md: '3rem' }}
pb={{ base: '3rem', md: '3rem' }}
wordBreak="break-word"
justify="center"
bg={titleBg}
Expand Down Expand Up @@ -214,6 +241,11 @@ export const FormHeader = ({
{loggedInId} - Log out
</Button>
) : null}
<ZoomControls
setDefaultSize={setDefaultSize}
setLargeSize={setLargeSize}
setLargestSize={setLargestSize}
/>
</Flex>
</Flex>
{
Expand Down

0 comments on commit 43af8d6

Please sign in to comment.