Skip to content

Commit

Permalink
rename: data/markdownDocument.jsx to data/index.jsx (#104)
Browse files Browse the repository at this point in the history
Additionally,
variable DATA to MARKDOWN_DOCUMENT_DATA_META
variable DATA_TAG to MARKDOWN_DOCUMENT_DATA_TAG_META
  • Loading branch information
lumirlumir authored Oct 15, 2024
1 parent c2bddf7 commit 9f89675
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
10 changes: 7 additions & 3 deletions src/components/aside/Categories/Categories.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Link from 'next/link';

import { DOCS } from '@/constants/path';
import { DATA_TAG } from '@/data/markdownDocument';
import { MARKDOWN_DOCUMENT_DATA_TAG_META } from '@/data';
import { readMarkdownTagTree } from '@/utils/fs';

/* React Declaration */
Expand All @@ -11,12 +11,16 @@ export default async function Categories() {
return (
<ul>
{Object.keys(tagTree)
.sort((a, b) => DATA_TAG[a].order - DATA_TAG[b].order)
.sort(
(a, b) =>
MARKDOWN_DOCUMENT_DATA_TAG_META[a].order -
MARKDOWN_DOCUMENT_DATA_TAG_META[b].order,
)
.map(key => {
const {
name: { en, ko },
reactIcons,
} = DATA_TAG[key];
} = MARKDOWN_DOCUMENT_DATA_TAG_META[key];

return (
<li key={key}>
Expand Down
20 changes: 10 additions & 10 deletions src/components/nav/SortContainer/SortContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { usePathname, useSearchParams, useRouter } from 'next/navigation';
import { FaArrowDownWideShort, FaArrowUpShortWide } from 'react-icons/fa6';
import { GrSort } from 'react-icons/gr';

import { DATA } from '@/data/markdownDocument';
import { MARKDOWN_DOCUMENT_DATA_META } from '@/data';

export default function SortContainer() {
const pathname = usePathname();
Expand All @@ -28,10 +28,10 @@ export default function SortContainer() {
{/* TODO: Make a reusable component named `SortItem.jsx` */}
<div>
<div>
{DATA.title.reactIcons}
{MARKDOWN_DOCUMENT_DATA_META.title.reactIcons}
<sup>
{DATA.title.name.en}
{DATA.title.name.ko}
{MARKDOWN_DOCUMENT_DATA_META.title.name.en}
{MARKDOWN_DOCUMENT_DATA_META.title.name.ko}
</sup>
</div>
<div>
Expand All @@ -45,10 +45,10 @@ export default function SortContainer() {
</div>
<div>
<div>
{DATA.created.reactIcons}
{MARKDOWN_DOCUMENT_DATA_META.created.reactIcons}
<sup>
{DATA.created.name.en}
{DATA.created.name.ko}
{MARKDOWN_DOCUMENT_DATA_META.created.name.en}
{MARKDOWN_DOCUMENT_DATA_META.created.name.ko}
</sup>
</div>
<div>
Expand All @@ -62,10 +62,10 @@ export default function SortContainer() {
</div>
<div>
<div>
{DATA.updated.reactIcons}
{MARKDOWN_DOCUMENT_DATA_META.updated.reactIcons}
<sup>
{DATA.updated.name.en}
{DATA.updated.name.ko}
{MARKDOWN_DOCUMENT_DATA_META.updated.name.en}
{MARKDOWN_DOCUMENT_DATA_META.updated.name.ko}
</sup>
</div>
<div>
Expand Down
4 changes: 2 additions & 2 deletions src/data/markdownDocument.jsx → src/data/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
*
* @type {{[key: string]: MarkdownDocumentDataMeta}}
*/
export const DATA = Object.freeze({
export const MARKDOWN_DOCUMENT_DATA_META = Object.freeze({
title: {
name: {
en: 'Title',
Expand Down Expand Up @@ -74,7 +74,7 @@ export const DATA = Object.freeze({
*
* @type {{[key: string]: MarkdownDocumentDataTagMeta}}
*/
export const DATA_TAG = Object.freeze({
export const MARKDOWN_DOCUMENT_DATA_TAG_META = Object.freeze({
html: {
name: {
en: 'HTML',
Expand Down

0 comments on commit 9f89675

Please sign in to comment.