-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
1,281 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,54 @@ | ||
"use client"; | ||
import Copy from "@/components/shared/copy"; | ||
import { FontKey, fonts } from "@/fonts"; | ||
import { FontKey, fonts, transforms } from "@/transforms"; | ||
import { HTMLAttributes } from "react"; | ||
|
||
type TransformMap = { [key: string]: string }; | ||
|
||
export const Fonts =({ | ||
export const Fonts = ({ | ||
className, | ||
content, | ||
currentFonts | ||
}:{ | ||
}: { | ||
className?: HTMLAttributes<HTMLDivElement>["className"]; | ||
currentFonts: Readonly<FontKey[]>; | ||
content: string; | ||
})=> { | ||
}) => { | ||
const FontItem = ({ fontKey }: { fontKey: FontKey }) => { | ||
const chars = transforms[fontKey] as TransformMap; | ||
|
||
// const adjustUnicode = (char: string) => { | ||
// const code = char.charCodeAt(0); | ||
// if (code >= 0x2000 && code <= 0x2FFF) { | ||
// return char + '\u034F\u0308'; | ||
// } | ||
// return char; | ||
// }; | ||
|
||
const transformAndAdjust = (text: string) => { | ||
return text.split('').map(char => { | ||
return chars[char] || char; | ||
// const transformedChar = chars[char] || char; | ||
// return adjustUnicode(transformedChar); | ||
}).join(''); | ||
}; | ||
|
||
const transformedContent = transformAndAdjust(content); | ||
|
||
return ( | ||
<div className="mb-5 pb-4 border-b leading-8"> | ||
<div className="mb-3 relative flex justify-between"> | ||
<div>{transformedContent}</div> | ||
<Copy>{transformedContent}</Copy> | ||
</div> | ||
<div className="text-muted-foreground text-sm">{fonts[fontKey]}</div> | ||
</div> | ||
); | ||
}; | ||
|
||
return ( | ||
<div className={className}> | ||
{currentFonts.map(key =>{ | ||
return( | ||
<div key={key} className="mb-5 pb-4 border-b leading-8"> | ||
<div className="mb-3 relative flex justify-between"> | ||
<div>{content}</div> | ||
<Copy>{content}</Copy> | ||
</div> | ||
<div className="text-muted-foreground text-sm">{fonts[key]}</div> | ||
</div> | ||
) | ||
})} | ||
{currentFonts.map(key => <FontItem key={key} fontKey={key} />)} | ||
</div> | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { FontKey } from "./fonts"; | ||
import { FontKey } from "./transforms"; | ||
|
||
|
||
export const slugKeys = [ | ||
"all", | ||
|
Oops, something went wrong.