Commit c647fc2f authored by tom's avatar tom

api docs pages

parent 99cb9b03
...@@ -4,7 +4,7 @@ import React from 'react'; ...@@ -4,7 +4,7 @@ import React from 'react';
import PageNextJs from 'nextjs/PageNextJs'; import PageNextJs from 'nextjs/PageNextJs';
import config from 'configs/app'; import config from 'configs/app';
// import SwaggerUI from 'ui/apiDocs/SwaggerUI'; import SwaggerUI from 'ui/apiDocs/SwaggerUI';
import PageTitle from 'ui/shared/Page/PageTitle'; import PageTitle from 'ui/shared/Page/PageTitle';
const Page: NextPage = () => { const Page: NextPage = () => {
...@@ -13,7 +13,7 @@ const Page: NextPage = () => { ...@@ -13,7 +13,7 @@ const Page: NextPage = () => {
<PageTitle <PageTitle
title={ config.meta.seo.enhancedDataEnabled ? `${ config.chain.name } API documentation` : 'API documentation' } title={ config.meta.seo.enhancedDataEnabled ? `${ config.chain.name } API documentation` : 'API documentation' }
/> />
{ /* <SwaggerUI/> */ } <SwaggerUI/>
</PageNextJs> </PageNextJs>
); );
}; };
......
...@@ -8,10 +8,10 @@ import config from 'configs/app'; ...@@ -8,10 +8,10 @@ import config from 'configs/app';
import ContentLoader from 'ui/shared/ContentLoader'; import ContentLoader from 'ui/shared/ContentLoader';
import PageTitle from 'ui/shared/Page/PageTitle'; import PageTitle from 'ui/shared/Page/PageTitle';
// const GraphQL = dynamic(() => import('ui/graphQL/GraphQL'), { const GraphQL = dynamic(() => import('ui/graphQL/GraphQL'), {
// loading: () => <ContentLoader/>, loading: () => <ContentLoader/>,
// ssr: false, ssr: false,
// }); });
const Page: NextPage = () => { const Page: NextPage = () => {
...@@ -20,7 +20,7 @@ const Page: NextPage = () => { ...@@ -20,7 +20,7 @@ const Page: NextPage = () => {
<PageTitle <PageTitle
title={ config.meta.seo.enhancedDataEnabled ? `GraphiQL ${ config.chain.name } interface` : 'GraphQL playground' } title={ config.meta.seo.enhancedDataEnabled ? `GraphiQL ${ config.chain.name } interface` : 'GraphQL playground' }
/> />
{ /* <GraphQL/> */ } <GraphQL/>
</PageNextJs> </PageNextJs>
); );
}; };
......
...@@ -453,10 +453,10 @@ const semanticTokens: ThemingConfig['semanticTokens'] = { ...@@ -453,10 +453,10 @@ const semanticTokens: ThemingConfig['semanticTokens'] = {
DEFAULT: { value: '{colors.gray.400}' }, DEFAULT: { value: '{colors.gray.400}' },
_dark: { value: '{colors.gray.500}' }, _dark: { value: '{colors.gray.500}' },
}, },
error: { // error: {
DEFAULT: { value: '{colors.red.500}' }, // DEFAULT: { value: '{colors.red.500}' },
_dark: { value: '{colors.red.500}' }, // _dark: { value: '{colors.red.500}' },
}, // },
// dialog_bg: { // dialog_bg: {
// DEFAULT: { value: '{colors.white}' }, // DEFAULT: { value: '{colors.white}' },
// _dark: { value: '{colors.gray.900}' }, // _dark: { value: '{colors.gray.900}' },
......
...@@ -5,7 +5,7 @@ const SwaggerUIReact = dynamic(() => import('swagger-ui-react'), { ...@@ -5,7 +5,7 @@ const SwaggerUIReact = dynamic(() => import('swagger-ui-react'), {
}); });
import type { SystemStyleObject } from '@chakra-ui/react'; import type { SystemStyleObject } from '@chakra-ui/react';
import { Box, useColorModeValue, useToken } from '@chakra-ui/react'; import { Box, useToken } from '@chakra-ui/react';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import React from 'react'; import React from 'react';
...@@ -29,84 +29,84 @@ const NeverShowInfoPlugin = () => { ...@@ -29,84 +29,84 @@ const NeverShowInfoPlugin = () => {
}; };
const SwaggerUI = () => { const SwaggerUI = () => {
const mainColor = useColorModeValue('blackAlpha.800', 'whiteAlpha.800'); const mainColor = { _light: 'blackAlpha.800', _dark: 'whiteAlpha.800' };
const borderColor = useToken('colors', 'border.divider'); const borderColor = useToken('colors', 'border.divider');
const mainBgColor = useColorModeValue('blackAlpha.100', 'whiteAlpha.200'); const mainBgColor = { _light: 'blackAlpha.100', _dark: 'whiteAlpha.200' };
const swaggerStyle: SystemStyleObject = { const swaggerStyle: SystemStyleObject = {
'.swagger-ui .scheme-container, .opblock-tag': { '& .swagger-ui .scheme-container, & .opblock-tag': {
display: 'none', display: 'none',
}, },
'.swagger-ui': { '& .swagger-ui': {
color: mainColor, color: mainColor,
}, },
'.swagger-ui .opblock-summary-control:focus': { '& .swagger-ui .opblock-summary-control:focus': {
outline: 'none', outline: 'none',
}, },
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
'.swagger-ui .opblock .opblock-summary-path, .swagger-ui .opblock .opblock-summary-description, .swagger-ui div, .swagger-ui p, .swagger-ui h5, .swagger-ui .response-col_links, .swagger-ui h4, .swagger-ui table thead tr th, .swagger-ui table thead tr td, .swagger-ui .parameter__name, .swagger-ui .parameter__type, .swagger-ui .response-col_status, .swagger-ui .tab li, .swagger-ui .opblock .opblock-section-header h4': { '& .swagger-ui .opblock .opblock-summary-path, & .swagger-ui .opblock .opblock-summary-description, & .swagger-ui div, & .swagger-ui p, & .swagger-ui h5, & .swagger-ui .response-col_links, & .swagger-ui h4, & .swagger-ui table thead tr th, & .swagger-ui table thead tr td, & .swagger-ui .parameter__name, & .swagger-ui .parameter__type, & .swagger-ui .response-col_status, & .swagger-ui .tab li, & .swagger-ui .opblock .opblock-section-header h4': {
color: 'unset', color: 'unset',
}, },
'.swagger-ui input': { '& .swagger-ui input': {
color: 'blackAlpha.800', color: 'blackAlpha.800',
}, },
'.swagger-ui .opblock .opblock-section-header': { '& .swagger-ui .opblock .opblock-section-header': {
background: useColorModeValue('whiteAlpha.800', 'blackAlpha.800'), background: { _light: 'whiteAlpha.800', _dark: 'blackAlpha.800' },
}, },
'.swagger-ui .response-col_description__inner p, .swagger-ui .parameters-col_description p': { '& .swagger-ui .response-col_description__inner p, & .swagger-ui .parameters-col_description p': {
margin: 0, margin: 0,
}, },
'.swagger-ui .wrapper': { '& .swagger-ui .wrapper': {
padding: 0, padding: 0,
}, },
'.swagger-ui .prop-type': { '& .swagger-ui .prop-type': {
color: useColorModeValue('blue.600', 'blue.400'), color: { _light: 'blue.600', _dark: 'blue.400' },
}, },
'.swagger-ui .btn.try-out__btn': { '& .swagger-ui .btn.try-out__btn': {
borderColor: useToken('colors', 'link'), borderColor: useToken('colors', 'link.primary'),
color: useToken('colors', 'link'), color: useToken('colors', 'link.primary'),
borderRadius: 'sm', borderRadius: 'sm',
}, },
'.swagger-ui .btn.try-out__btn:hover': { '& .swagger-ui .btn.try-out__btn:hover': {
boxShadow: 'none', boxShadow: 'none',
borderColor: useToken('colors', 'link_hovered'), borderColor: useToken('colors', 'link.primary.hover'),
color: useToken('colors', 'link_hovered'), color: useToken('colors', 'link.primary.hover'),
}, },
'.swagger-ui .btn.try-out__btn.cancel': { '& .swagger-ui .btn.try-out__btn.cancel': {
borderColor: useToken('colors', 'error'), borderColor: useToken('colors', 'text.error'),
color: useToken('colors', 'error'), color: useToken('colors', 'text.error'),
}, },
'.swagger-ui .btn.try-out__btn.cancel:hover': { '& .swagger-ui .btn.try-out__btn.cancel:hover': {
borderColor: useColorModeValue('red.600', 'red.500'), borderColor: { _light: 'red.600', _dark: 'red.500' },
color: useColorModeValue('red.500', 'red.400'), color: { _light: 'red.500', _dark: 'red.400' },
}, },
// MODELS // MODELS
'.swagger-ui section.models': { '& .swagger-ui section.models': {
borderColor: borderColor, borderColor: borderColor,
}, },
'.swagger-ui section.models h4': { '& .swagger-ui section.models h4': {
color: mainColor, color: mainColor,
}, },
'.swagger-ui section.models .model-container': { '& .swagger-ui section.models .model-container': {
bgColor: mainBgColor, bgColor: mainBgColor,
}, },
'.swagger-ui .model-title': { '& .swagger-ui .model-title': {
wordBreak: 'break-all', wordBreak: 'break-all',
color: mainColor, color: mainColor,
}, },
'.swagger-ui .model': { '& .swagger-ui .model': {
color: mainColor, color: mainColor,
}, },
'.swagger-ui .model-box-control:focus': { '& .swagger-ui .model-box-control:focus': {
outline: 'none', outline: 'none',
}, },
'.swagger-ui .model-toggle': { '& .swagger-ui .model-toggle': {
bgColor: useColorModeValue('transparent', 'whiteAlpha.700'), bgColor: { _light: 'transparent', _dark: 'whiteAlpha.700' },
borderRadius: 'sm', borderRadius: 'sm',
}, },
'.swagger-ui .model .property.primitive': { '& .swagger-ui .model .property.primitive': {
color: useToken('colors', 'text_secondary'), color: useToken('colors', 'text_.secondary'),
wordBreak: 'break-all', wordBreak: 'break-all',
}, },
}; };
...@@ -132,7 +132,7 @@ const SwaggerUI = () => { ...@@ -132,7 +132,7 @@ const SwaggerUI = () => {
} }
return ( return (
<Box sx={ swaggerStyle }> <Box css={ swaggerStyle }>
<SwaggerUIReact <SwaggerUIReact
url={ feature.specUrl } url={ feature.specUrl }
plugins={ [ NeverShowInfoPlugin ] } plugins={ [ NeverShowInfoPlugin ] }
......
import { Box, useColorMode } from '@chakra-ui/react'; import { Box } from '@chakra-ui/react';
import { createGraphiQLFetcher } from '@graphiql/toolkit'; import { createGraphiQLFetcher } from '@graphiql/toolkit';
import { GraphiQL } from 'graphiql'; import { GraphiQL } from 'graphiql';
import React from 'react'; import React from 'react';
...@@ -7,6 +7,7 @@ import config from 'configs/app'; ...@@ -7,6 +7,7 @@ import config from 'configs/app';
import buildUrl from 'lib/api/buildUrl'; import buildUrl from 'lib/api/buildUrl';
import 'graphiql/graphiql.css'; import 'graphiql/graphiql.css';
import isBrowser from 'lib/isBrowser'; import isBrowser from 'lib/isBrowser';
import { useColorMode } from 'toolkit/chakra/color-mode';
const feature = config.features.graphqlApiDocs; const feature = config.features.graphqlApiDocs;
...@@ -61,8 +62,8 @@ const GraphQL = () => { ...@@ -61,8 +62,8 @@ const GraphQL = () => {
}); });
return ( return (
<Box h="100vh" overflowX="scroll" sx={ graphQLStyle }> <Box h="100vh" overflowX="scroll" css={ graphQLStyle }>
<Box h="100vh" minW="900px" sx={ graphQLStyle }> <Box h="100vh" minW="900px" css={ graphQLStyle }>
<GraphiQL fetcher={ fetcher } defaultQuery={ initialQuery } key={ colorModeState }/> <GraphiQL fetcher={ fetcher } defaultQuery={ initialQuery } key={ colorModeState }/>
</Box> </Box>
</Box> </Box>
......
...@@ -18,6 +18,7 @@ import LoadersShowcase from 'ui/showcases/Loaders'; ...@@ -18,6 +18,7 @@ import LoadersShowcase from 'ui/showcases/Loaders';
import MenuShowcase from 'ui/showcases/Menu'; import MenuShowcase from 'ui/showcases/Menu';
import PaginationShowcase from 'ui/showcases/Pagination'; import PaginationShowcase from 'ui/showcases/Pagination';
import PinInputShowcase from 'ui/showcases/PinInput'; import PinInputShowcase from 'ui/showcases/PinInput';
import PopoverShowcase from 'ui/showcases/Popover';
import ProgressCircleShowcase from 'ui/showcases/ProgressCircle'; import ProgressCircleShowcase from 'ui/showcases/ProgressCircle';
import RadioShowcase from 'ui/showcases/Radio'; import RadioShowcase from 'ui/showcases/Radio';
import SelectShowcase from 'ui/showcases/Select'; import SelectShowcase from 'ui/showcases/Select';
...@@ -53,6 +54,7 @@ const tabs = [ ...@@ -53,6 +54,7 @@ const tabs = [
{ label: 'Progress Circle', value: 'progress-circle', component: <ProgressCircleShowcase/> }, { label: 'Progress Circle', value: 'progress-circle', component: <ProgressCircleShowcase/> },
{ label: 'Radio', value: 'radio', component: <RadioShowcase/> }, { label: 'Radio', value: 'radio', component: <RadioShowcase/> },
{ label: 'Pin input', value: 'pin-input', component: <PinInputShowcase/> }, { label: 'Pin input', value: 'pin-input', component: <PinInputShowcase/> },
{ label: 'Popover', value: 'popover', component: <PopoverShowcase/> },
{ label: 'Select', value: 'select', component: <SelectShowcase/> }, { label: 'Select', value: 'select', component: <SelectShowcase/> },
{ label: 'Table', value: 'table', component: <TableShowcase/> }, { label: 'Table', value: 'table', component: <TableShowcase/> },
{ label: 'Tabs', value: 'tabs', component: <TabsShowcase/> }, { label: 'Tabs', value: 'tabs', component: <TabsShowcase/> },
...@@ -79,7 +81,7 @@ const ChakraShowcases = () => { ...@@ -79,7 +81,7 @@ const ChakraShowcases = () => {
<TabsTrigger key={ tab.value } value={ tab.value }>{ tab.label }</TabsTrigger> <TabsTrigger key={ tab.value } value={ tab.value }>{ tab.label }</TabsTrigger>
)) } )) }
</TabsList> </TabsList>
{ tabs.map((tab) => tab.component) } { tabs.map((tab) => <React.Fragment key={ tab.value }>{ tab.component }</React.Fragment>) }
</TabsRoot> </TabsRoot>
</> </>
); );
......
import React from 'react';
import { Button } from 'toolkit/chakra/button';
import { PopoverRoot, PopoverTrigger, PopoverContent, PopoverBody } from 'toolkit/chakra/popover';
import { Section, Container, SectionHeader, SamplesStack, Sample } from './parts';
const PopoverShowcase = () => {
return (
<Container value="popover">
<Section>
<SectionHeader>Size</SectionHeader>
<SamplesStack>
<Sample label="size: sm">
<PopoverRoot>
<PopoverTrigger>
<Button variant="dropdown">Trigger</Button>
</PopoverTrigger>
<PopoverContent>
<PopoverBody>
Popover content
</PopoverBody>
</PopoverContent>
</PopoverRoot>
</Sample>
</SamplesStack>
</Section>
</Container>
);
};
export default React.memo(PopoverShowcase);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment