Skip to content

Commit

Permalink
fix: #5, Adicionado forma de voltar ao JSON
Browse files Browse the repository at this point in the history
Adicionado botão de JSON Raw, para voltar ao JSON original
  • Loading branch information
avuenja committed Aug 8, 2022
1 parent dc92fe6 commit b56d61a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/pages/json-pretty.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import React from 'react'
import Head from 'next/head'
import { motion } from 'framer-motion'
import { Button, Textarea, useColorModeValue, VStack } from '@chakra-ui/react'
import {
Button,
HStack,
Textarea,
useColorModeValue,
VStack,
} from '@chakra-ui/react'

import AppCodeBlock from '@/components/app-code-block'

Expand Down Expand Up @@ -30,6 +36,11 @@ const JsonPretty = () => {
}
}

const handleBack = () => {
setPrettyJson('')
setIsInvalid(false)
}

const handleNew = () => {
setJson('')
setPrettyJson('')
Expand All @@ -49,7 +60,10 @@ const JsonPretty = () => {
<VStack flex="1" justifyContent="center" spacing="5">
{prettyJson.length > 0 ? (
<>
<Button onClick={handleNew}>New Pretty</Button>
<HStack spacing="5">
<Button onClick={handleBack}>JSON Raw</Button>
<Button onClick={handleNew}>New Pretty</Button>
</HStack>

<motion.div
key={'pretty-json'}
Expand Down

1 comment on commit b56d61a

@vercel
Copy link

@vercel vercel bot commented on b56d61a Aug 8, 2022

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.