Skip to content

Commit

Permalink
Fix design errors
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-md committed May 15, 2024
1 parent f8cd465 commit b9ee1d5
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/generateApiReference.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ ${curlify({
</CH.Code>
</CH.Section>
<Box sx={{ fontSize: '12px', mt: -5, mb: 3 }}>
This snippet shows a sample request on mainnet. For other networks you should use
This snippet shows a sample request on mainnet. For other networks please use
<Link
href='/core-api/transaction-service-supported-networks'
rel='noopener noreferrer'
Expand Down
3 changes: 3 additions & 0 deletions assets/svg/hashtag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion components/ApiReference/ApiReference.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const ApiReference: React.FC = () => {
px: 0.8,
position: 'fixed',
bottom: [120, 60],
right: 10,
right: 16,
zIndex: 1000,
opacity: currentIndex !== '' ? 1 : 0,
transition: 'opacity 0.3s',
Expand Down
1 change: 0 additions & 1 deletion components/ApiReference/Network.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ const NetworkSwitcher: React.FC = () => {
my={2}
sx={{ width: ['100%', '100%', 'auto'] }}
item
wrap='nowrap'
>
<Link href={network} target='_blank' rel='noopener noreferrer'>
<Typography
Expand Down
26 changes: 12 additions & 14 deletions components/Loader.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import Box from '@mui/material/Box'
import CircularProgress from '@mui/material/CircularProgress'

const Loader: React.FC = () => {
return (
<Box
sx={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
height: '100vh'
}}
>
<CircularProgress />
</Box>
)
}
const Loader: React.FC = () => (
<Box
sx={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
height: '100vh'
}}
>
<CircularProgress />
</Box>
)

export default Loader
10 changes: 6 additions & 4 deletions lib/mdx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ import MuiLink from '@mui/material/Link'
import { type Heading } from '../components/ApiReference/TOC'
import swagger from '../components/ApiReference/mainnet-swagger.json'
import pathsMetadata from '../components/ApiReference/paths-metadata.json'
import HashTag from '../assets/svg/hashtag.svg'

export const slugify: (text: string) => string = text =>
text?.replace(' #', '')?.replace?.(/ /g, '-').replace(/\//g, '-')
text?.replace?.(/ /g, '-').replace(/\//g, '-')

export const getHeadingChildren: (heading: string) => Heading[] = heading => {
const headingPath = '/v1/' + heading + '/'
Expand Down Expand Up @@ -61,9 +62,10 @@ export const getHeadingsFromHtml: (
const headingText = heading
.replace(/<[^>]*>/g, '')
.replace(/&nbsp;/g, ' ')
.replace(' #', '')
.split('.')[0]
.trim()
const link = `#${slugify(headingText)}`
let link = `#${slugify(headingText)}`
if (link.slice(-1) === '-') link = link.slice(0, -1)
return {
text: headingText,
link,
Expand Down Expand Up @@ -109,7 +111,7 @@ export const MdxHeading: React.FC<{
}
}}
>
#
<HashTag width='15px' height='35px' />
</Button>
)}
</Typography>
Expand Down

0 comments on commit b9ee1d5

Please sign in to comment.