Skip to content

Commit

Permalink
feat: fix button position
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoaerobr committed Dec 18, 2024
1 parent d161f80 commit 9c15899
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 77 deletions.
12 changes: 7 additions & 5 deletions src/components/tutorial-markdown-render/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ interface Props {
title: string
category: string
}[]
// sectionSelected: string
// sidebarfallback: any //eslint-disable-line
slug: string
// parentsArray: string[]
// path: string
isListed: boolean
branch: string
pagination: {
Expand All @@ -50,6 +46,7 @@ interface Props {
breadcrumbList: { slug: string; name: string; type: string }[]
headings: Item[]
}

const TutorialMarkdownRender = (props: Props) => {
const intl = useIntl()

Expand Down Expand Up @@ -90,11 +87,16 @@ const TutorialMarkdownRender = (props: Props) => {
<Breadcrumb breadcrumbList={props.breadcrumbList} />
<Text sx={styles.documentationTitle} className="title">
{props.serialized.frontmatter?.title}
{/* Adiciona a propriedade justifyContent ao Flex para alinhar o botão à direita */}
<Flex
sx={{ display: 'flex', justifyContent: 'flex-end' }}
>
<CopyLinkButton />
</Flex>
</Text>
<Text sx={styles.documentationExcerpt}>
{props.serialized.frontmatter?.excerpt}
</Text>
<CopyLinkButton />
</header>
{props.serialized.frontmatter?.readingTime && (
<TimeToRead
Expand Down
25 changes: 1 addition & 24 deletions src/pages/announcements/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,30 +109,6 @@ const AnnouncementPage: NextPage<Props> = ({
<Flex sx={styles.innerContainer}>
<Box sx={styles.articleBox}>
<Box sx={styles.contentContainer}>
<article ref={articleRef}>
<header>
<Breadcrumb breadcrumbList={[breadcrumb]} />
<Text sx={styles.documentationTitle} className="title">
{serialized.frontmatter?.title}
</Text>
<Box sx={styles.divider}></Box>
<Flex sx={styles.flexContainer}>
<Box>
<Author contributor={contributor} />
{createdAtDate && updatedAtDate && (
<Flex sx={styles.date}>
<DateText
createdAt={createdAtDate}
updatedAt={updatedAtDate}
/>
</Flex>
)}
</Box>
<CopyLinkButton />
</Flex>
</header>
<MarkdownRenderer serialized={serialized} />
</article>
<Box sx={styles.textContainer}>
<article ref={articleRef}>
<header>
Expand All @@ -150,6 +126,7 @@ const AnnouncementPage: NextPage<Props> = ({
createdAt={createdAtDate}
updatedAt={updatedAtDate}
/>
<CopyLinkButton />
</Flex>
)}
</Box>
Expand Down
38 changes: 10 additions & 28 deletions src/pages/docs/tracks/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ import {
import { MarkdownRenderer } from '@vtexdocs/components'

import { remarkReadingTime } from 'utils/remark_plugins/remarkReadingTime'
import CopyLinkButton from 'components/copy-link-button'

import theme from 'styles/code-hike-theme'
import TimeToRead from 'components/TimeToRead'
import { getBreadcrumbsList } from 'utils/getBreadcrumbsList'
import CopyLinkButton from 'components/copy-link-button'

const docsPathsGLOBAL = await getTracksPaths('tracks')

Expand Down Expand Up @@ -140,7 +140,15 @@ const TrackPage: NextPage<Props> = ({
minutes={serialized.frontmatter.readingTime}
/>
)}
<CopyLinkButton />
{/* Adiciona a propriedade justifyContent ao Flex para alinhar o botão à direita */}
<Flex
sx={{
...styles.copyLinkContainer,
justifyContent: 'flex-end',
}}
>
<CopyLinkButton />
</Flex>
</Flex>
</header>
<MarkdownRenderer serialized={serialized} />
Expand Down Expand Up @@ -211,12 +219,6 @@ export const getServerSideProps: GetServerSideProps = async ({
}
}

// let documentationContent = await getGithubFile(
// 'vtexdocs',
// 'help-center-content',
// branch,
// path
// )
let documentationContent =
(await fetch(
`https://raw.githubusercontent.com/vtexdocs/help-center-content/${branch}/${path}`
Expand All @@ -238,7 +240,6 @@ export const getServerSideProps: GetServerSideProps = async ({
.then((res) => res.json())
.then(({ users }) => {
const result: ContributorsType[] = []
// eslint-disable-next-line @typescript-eslint/no-explicit-any
for (let i = 0; i < users.length; i++) {
const user = users[i]
if (user.id === '41898282') continue
Expand All @@ -254,17 +255,6 @@ export const getServerSideProps: GetServerSideProps = async ({
})
.catch((err) => console.log(err))) || []

// const contributors = []
// const contributors =
// (await getFileContributors(
// 'vtexdocs',
// 'help-center-content',
// branch,
// path
// ).catch((err) => {
// console.log(err)
// })) || []

let format: 'md' | 'mdx' = 'mdx'
try {
if (path.endsWith('.md')) {
Expand Down Expand Up @@ -298,7 +288,6 @@ export const getServerSideProps: GetServerSideProps = async ({
},
})

// Check the frontmatter status
if (serialized.frontmatter?.status !== 'PUBLISHED') {
return {
notFound: true,
Expand Down Expand Up @@ -331,13 +320,6 @@ export const getServerSideProps: GetServerSideProps = async ({
.then((res) => res.text())
.catch((err) => console.log(err))) || ''

// const documentationContent = await getGithubFile(
// 'vtexdocs',
// 'help-center-content',W
// 'main',
// seeAlsoPath
// )

const serialized = await serialize(documentationContent, {
parseFrontmatter: true,
})
Expand Down
28 changes: 19 additions & 9 deletions src/pages/faq/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import TimeToRead from 'components/TimeToRead'

import getHeadings from 'utils/getHeadings'
import getNavigation from 'utils/getNavigation'
// import getGithubFile from 'utils/getGithubFile'
import escapeCurlyBraces from 'utils/escapeCurlyBraces'
import replaceHTMLBlocks from 'utils/replaceHTMLBlocks'
import { PreviewContext } from 'utils/contexts/preview'
Expand All @@ -36,7 +35,6 @@ import { ContributorsType } from 'utils/getFileContributors'
import { getLogger } from 'utils/logging/log-util'
import { localeType } from 'utils/navigation-utils'
import { MarkdownRenderer } from '@vtexdocs/components'
// import { ParsedUrlQuery } from 'querystring'
import { remarkReadingTime } from 'utils/remark_plugins/remarkReadingTime'
import { getDocsPaths as getFaqPaths } from 'utils/getDocsPaths'
import { getMessages } from 'utils/get-messages'
Expand All @@ -57,8 +55,6 @@ interface Props {
}

const FaqPage: NextPage<Props> = ({
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
serialized,
headingList,
contributors,
Expand Down Expand Up @@ -114,13 +110,27 @@ const FaqPage: NextPage<Props> = ({
minutes={serialized.frontmatter.readingTime}
/>
)}

{/* Verifica se as datas de criação e atualização estão disponíveis */}
{createdAtDate && updatedAtDate && (
<DateText
createdAt={createdAtDate}
updatedAt={updatedAtDate}
/>
<Flex sx={{ alignItems: 'center' }}>
<DateText
createdAt={createdAtDate}
updatedAt={updatedAtDate}
/>

{/* Coloca o botão à direita das datas */}
<Flex
sx={{
...styles.copyLinkContainer,
ml: 2,
justifyContent: 'flex-end',
}}
>
<CopyLinkButton />
</Flex>
</Flex>
)}
<CopyLinkButton />
</Flex>
</header>
<MarkdownRenderer serialized={serialized} />
Expand Down
25 changes: 19 additions & 6 deletions src/pages/known-issues/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import hljsCurl from 'highlightjs-curl'
import remarkBlockquote from 'utils/remark_plugins/rehypeBlockquote'
import { remarkCodeHike } from '@code-hike/mdx'
import theme from 'styles/code-hike-theme'

import remarkImages from 'utils/remark_plugins/plaiceholder'

import { Box, Flex, Text } from '@vtex/brand-ui'
Expand Down Expand Up @@ -117,7 +116,6 @@ const KnownIssuePage: NextPage<Props> = ({
minutes={serialized.frontmatter.readingTime}
/>
)}
<CopyLinkButton />
</Flex>
<Box sx={styles.divider}></Box>
<Flex sx={styles.detailedInfo}>
Expand All @@ -127,11 +125,26 @@ const KnownIssuePage: NextPage<Props> = ({
</Text>
<Tag>{serialized.frontmatter?.kiStatus}</Tag>
</Flex>

{/* Reorganizado para colocar o botão após as datas */}
{createdAtDate && updatedAtDate && (
<DateText
createdAt={createdAtDate}
updatedAt={updatedAtDate}
/>
<Flex sx={{ alignItems: 'center' }}>
<DateText
createdAt={createdAtDate}
updatedAt={updatedAtDate}
/>
{/* Adicionando o botão à direita das datas */}
<Flex
sx={{
display: 'flex',
justifyContent: 'flex-end',
alignItems: 'center',
ml: 2,
}}
>
<CopyLinkButton />
</Flex>
</Flex>
)}
</Flex>
</header>
Expand Down
23 changes: 18 additions & 5 deletions src/pages/troubleshooting/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,26 @@ const TroubleshootingPage: NextPage<Props> = ({
(serialized.frontmatter?.readingTime as string) ?? 0
}
/>

{/* Reorganizado para colocar o botão após as datas */}
{createdAtDate && updatedAtDate && (
<DateText
createdAt={createdAtDate}
updatedAt={updatedAtDate}
/>
<Flex sx={{ alignItems: 'center' }}>
<DateText
createdAt={createdAtDate}
updatedAt={updatedAtDate}
/>
<Flex
sx={{
display: 'flex',
justifyContent: 'flex-end',
alignItems: 'center',
ml: 2,
}}
>
<CopyLinkButton />
</Flex>
</Flex>
)}
<CopyLinkButton />
</Flex>
</header>
<MarkdownRenderer serialized={serialized} />
Expand Down

0 comments on commit 9c15899

Please sign in to comment.