Skip to content

Commit

Permalink
fix(v1.1): update text positioning & fix error matching element
Browse files Browse the repository at this point in the history
  • Loading branch information
hendraaagil committed May 27, 2021
1 parent ca56cd3 commit 8d997bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
10 changes: 8 additions & 2 deletions components/nav/Navbar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Link from 'next/link';
import { useEffect, useState } from 'react';
import {
Box,
Container,
Expand All @@ -15,8 +16,13 @@ import MenuDrawer from './menu/MenuDrawer';

const Navbar = () => {
const [isLargerThan425] = useMediaQuery('(min-width: 425px)');
const [larger, setLarger] = useState(true);
const { isOpen, onOpen, onClose } = useDisclosure();

useEffect(() => {
setLarger(isLargerThan425);
}, [isLargerThan425]);

return (
<>
<Box
Expand Down Expand Up @@ -49,7 +55,7 @@ const Navbar = () => {
hendraaagil
</Heading>
</Link>
{isLargerThan425 && (
{larger && (
<HStack spacing={10}>
{links.map((link, index) => (
<NavLink key={index} link={link.url} name={link.name} />
Expand All @@ -59,7 +65,7 @@ const Navbar = () => {
</HStack>
</Container>
</Box>
{!isLargerThan425 && (
{!larger && (
<>
<MenuButton onOpen={onOpen} />
<MenuDrawer isOpen={isOpen} onClose={onClose} links={links} />
Expand Down
20 changes: 11 additions & 9 deletions pages/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { Box, Heading, Text } from '@chakra-ui/react';
import { Box, Flex, Heading, Text } from '@chakra-ui/react';

import { getAge } from '../lib/age';

export default function Home() {
return (
<Box py={40} textAlign="center">
<Heading as="h1" mb={4}>
Hello, I'm Hendra Agil 👋
</Heading>
<Text fontSize="2xl" fontWeight="600">
Student. {getAge()} years old.
</Text>
</Box>
<Flex align="center" justify="center" minH="100vh">
<Box pb="72px" textAlign="center">
<Heading as="h1" mb={4}>
Hello, I'm Hendra Agil 👋
</Heading>
<Text fontSize="2xl" fontWeight="600">
Student. {getAge()} years old.
</Text>
</Box>
</Flex>
);
}

1 comment on commit 8d997bc

@vercel
Copy link

@vercel vercel bot commented on 8d997bc May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.