diff --git a/src/pages/docs.tsx b/src/pages/docs.tsx index d6311f1..d79f9fa 100644 --- a/src/pages/docs.tsx +++ b/src/pages/docs.tsx @@ -1,7 +1,7 @@ import React from "react"; import Head from "next/head"; import styled from "styled-components"; -import { MediaQuery, Text, Title } from "@mantine/core"; +import { Group, MediaQuery, Paper, Stack, Text, Title } from "@mantine/core"; import { Prism } from "@mantine/prism"; import Layout from "src/layout/Layout"; @@ -12,21 +12,6 @@ const StyledFrame = styled.iframe` margin: 3% auto; `; -const StyledPage = styled.div` - padding: 0 5%; - color: black; -`; - -const StyledContent = styled.section` - margin-top: 20px; - background: rgba(96, 96, 96, 0.23); - padding: 16px; - border-radius: 6px; - border: 1px solid #383838; -`; - -const StyledDescription = styled.div``; - const StyledContentBody = styled.div` display: flex; flex-direction: column; @@ -34,7 +19,7 @@ const StyledContentBody = styled.div` gap: 15px; line-height: 1.8; - ${StyledDescription} { + ${Text} { flex: 1; } `; @@ -59,14 +44,18 @@ const Docs = () => { Documentation - JSON Crack Docs - -

Documentation

- - + <Stack mx="auto" maw="75%"> + <Group mb="lg" mt={40}> + <Title order={1} color="dark"> + Documentation + + + + # Fetching from URL - + By adding ?json=https://catfact.ninja/fact query at the end of iframe src you will be able to fetch from URL at widgets without additional scripts. This applies to editor page as well, the following link will fetch the url at @@ -78,10 +67,9 @@ const Docs = () => { > https://jsoncrack.com/editor?json=https://catfact.ninja/fact - + { CodePen. - - + + # Embed Saved JSON - + Just like fetching from URL above, you can embed saved public json by adding the json id to "json" query{" "} ?json=639b65c5a82efc29a24b2de2 - + { CodePen. - - + + # Communicating with API

◼︎ Post Message to Embed

- + Communicating with the embed is possible with{" "} { } - + { CodePen. -
- + +

◼︎ On Page Load

- + ⚠️ Important! - iframe should be defined before the script tag @@ -163,9 +151,8 @@ const Docs = () => { sends its id attribute so you can listen for it as in the example below to ensure its loaded and ready to listen for messages. - + { CodePen. -
-
+ + ); };