Skip to content

Commit 88b49aa

Browse files
used flex
1 parent 2242494 commit 88b49aa

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

src/components/TutorialMetadata.tsx

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
import { useRouter } from "next/router";
2-
import { useTranslation } from "next-i18next";
3-
import { Badge } from "@chakra-ui/react";
1+
import { useRouter } from "next/router"
2+
import { useTranslation } from "next-i18next"
3+
import { Badge } from "@chakra-ui/react"
44

5-
import type { Lang, TranslationKey } from "@/lib/types";
6-
import { TutorialFrontmatter } from "@/lib/interfaces";
5+
import type { Lang, TranslationKey } from "@/lib/types"
6+
import { TutorialFrontmatter } from "@/lib/interfaces"
77

8-
import CopyToClipboard from "@/components/CopyToClipboard";
9-
import Emoji from "@/components/Emoji";
10-
import InlineLink from "@/components/Link";
11-
import Translation from "@/components/Translation";
12-
import TutorialTags from "@/components/TutorialTags";
8+
import CopyToClipboard from "@/components/CopyToClipboard"
9+
import Emoji from "@/components/Emoji"
10+
import InlineLink from "@/components/Link"
11+
import Translation from "@/components/Translation"
12+
import TutorialTags from "@/components/TutorialTags"
1313

14-
import { getLocaleTimestamp } from "@/lib/utils/time";
15-
import { Flex } from "./ui/flex";
14+
import { getLocaleTimestamp } from "@/lib/utils/time"
15+
16+
import { Flex } from "./ui/flex"
1617

1718
export type TutorialMetadataProps = {
18-
frontmatter: TutorialFrontmatter;
19-
timeToRead: number;
20-
};
19+
frontmatter: TutorialFrontmatter
20+
timeToRead: number
21+
}
2122

2223
export enum Skill {
2324
BEGINNER = "beginner",
@@ -27,67 +28,66 @@ export enum Skill {
2728

2829
export const getSkillTranslationId = (skill: Skill): TranslationKey =>
2930
`page-developers-tutorials:page-tutorial-${Skill[skill.toUpperCase() as keyof typeof Skill]
30-
}`;
31+
}`
3132

3233
const TutorialMetadata = ({
3334
frontmatter,
3435
timeToRead,
3536
}: TutorialMetadataProps) => {
36-
const { locale } = useRouter();
37-
const { t } = useTranslation("page-developers-tutorials");
37+
const { locale } = useRouter()
38+
const { t } = useTranslation("page-developers-tutorials")
3839

39-
const hasSource = frontmatter.source && frontmatter.sourceUrl;
40-
const published = frontmatter.published;
41-
const author = frontmatter.author;
42-
const address = frontmatter.address;
40+
const hasSource = frontmatter.source && frontmatter.sourceUrl
41+
const published = frontmatter.published
42+
const author = frontmatter.author
43+
const address = frontmatter.address
4344

4445
return (
45-
<Flex className=" flex-col justify-between pb-2 border-b-0 lg:border-b border-border">
46-
<Flex className=" justify-between items-center w-full mb-8">
47-
<div className="flex flex-wrap w-full">
46+
<Flex className="flex-col justify-between border-b-0 border-border pb-2 lg:border-b">
47+
<Flex className="mb-8 w-full items-center justify-between">
48+
<Flex className="w-full flex-wrap">
4849
<TutorialTags tags={frontmatter.tags} />
49-
</div>
50-
<Badge variant="secondary" className="self-start mb-2 whitespace-nowrap">
50+
</Flex>
51+
<Badge
52+
variant="secondary"
53+
className="mb-2 self-start whitespace-nowrap"
54+
>
5155
{t(getSkillTranslationId(frontmatter.skill as Skill))}
5256
</Badge>
5357
</Flex>
54-
<div className="flex flex-wrap gap-4 mt-[-1rem] text-sm text-text300 mb-6">
58+
<Flex className="text-text300 mb-6 mt-[-1rem] flex-wrap gap-4 text-sm">
5559
{author && (
5660
<div>
5761
<Emoji className="me-2 text-sm" text=":writing_hand:" />
5862
{author}
5963
</div>
6064
)}
6165
{hasSource && (
62-
<div >
66+
<div>
6367
<Emoji className="me-2 text-sm" text=":books:" />
6468
<InlineLink href={frontmatter.sourceUrl}>
6569
{frontmatter.source}
6670
</InlineLink>
6771
</div>
6872
)}
6973
{published && (
70-
<div >
74+
<div>
7175
<Emoji className="me-2 text-sm" text=":calendar:" />{" "}
7276
{getLocaleTimestamp(locale! as Lang, published)}
7377
</div>
7478
)}
75-
<div >
76-
<Emoji className="me-2 text-sm" text=":stopwatch:" />
79+
<div>
80+
<Emoji className="me-2 text-sm" text=":stopwatch:" />
7781
{timeToRead} {t("comp-tutorial-metadata-minute-read")} minute read
7882
</div>
79-
</div>
83+
</Flex>
8084
{address && (
81-
<div className="flex flex-wrap mt-[-1rem] text-sm text-text300 mb-6">
85+
<Flex className="text-text300 mb-6 mt-[-1rem] flex-wrap text-sm">
8286
<CopyToClipboard text={address}>
8387
{(isCopied) => (
84-
<div
85-
className="text-primary cursor-pointer overflow-hidden text-ellipsis font-mono bg-ednBackground px-1 text-sm hover:bg-primary100"
86-
>
88+
<div className="bg-ednBackground hover:bg-primary100 cursor-pointer overflow-hidden text-ellipsis px-1 font-mono text-sm text-primary">
8789
<div className="uppercase">
88-
<Translation
89-
id="comp-tutorial-metadata-tip-author"
90-
/>{" "}
90+
<Translation id="comp-tutorial-metadata-tip-author" />{" "}
9191
</div>
9292
{address} {isCopied && <Translation id="copied" />}
9393
{isCopied && (
@@ -96,10 +96,10 @@ const TutorialMetadata = ({
9696
</div>
9797
)}
9898
</CopyToClipboard>
99-
</div>
99+
</Flex>
100100
)}
101101
</Flex>
102-
);
103-
};
102+
)
103+
}
104104

105-
export default TutorialMetadata;
105+
export default TutorialMetadata

0 commit comments

Comments
 (0)