changed prettier config

This commit is contained in:
Kim, Jimin 2022-01-11 17:25:15 +09:00
parent 5a3e0d2623
commit 1758571f4a
37 changed files with 236 additions and 311 deletions

View file

@ -1,5 +1,4 @@
{ {
"tabWidth": 4,
"useTabs": true, "useTabs": true,
"semi": false "semi": false
} }

View file

@ -79,8 +79,7 @@ export function parseFrontMatter(
).data ).data
if (mode != ParseMode.PORTFOLIO) { if (mode != ParseMode.PORTFOLIO) {
if (!frontMatter.title) if (!frontMatter.title) throw Error(`Title is not defined in file: ${path}`)
throw Error(`Title is not defined in file: ${path}`)
if (mode != ParseMode.UNSEARCHABLE && !frontMatter.date) if (mode != ParseMode.UNSEARCHABLE && !frontMatter.date)
throw Error(`Date is not defined in file: ${path}`) throw Error(`Date is not defined in file: ${path}`)

View file

@ -1,4 +1,5 @@
<div class="items-wrapper"> <div class="items-wrapper">
<% badges.forEach((badge) => { %> <%- include("badge.ejs", { badge }) %> <% <% badges.forEach((badge) => { %>
}) %> <%- include("badge.ejs", { badge }) %>
<% }) %>
</div> </div>

View file

@ -44,9 +44,7 @@ function parseSeries() {
// series length and order // series length and order
for (const seriesURL in seriesMap) { for (const seriesURL in seriesMap) {
map.series[seriesURL].length = seriesMap[seriesURL].length map.series[seriesURL].length = seriesMap[seriesURL].length
map.series[seriesURL].order = seriesMap[seriesURL].map( map.series[seriesURL].order = seriesMap[seriesURL].map((item) => item.url)
(item) => item.url
)
} }
} }
@ -68,13 +66,9 @@ function generatePortfolioSVGs() {
} }
for (const skillCategory in skills) { for (const skillCategory in skills) {
skills[skillCategory as keyof typeof skills].forEach( skills[skillCategory as keyof typeof skills].forEach((badge: string) => {
(badge: string) => { data[skillCategory as keyof typeof skills].push(parseBadge(badge))
data[skillCategory as keyof typeof skills].push( })
parseBadge(badge)
)
}
)
} }
const renderedSVG = ejs.render( const renderedSVG = ejs.render(
@ -92,9 +86,7 @@ function parseBadge(badgeRaw: string): Badge {
const isMultiWord = badgeRaw.includes(" ") const isMultiWord = badgeRaw.includes(" ")
const words = badgeRaw.split(" ") const words = badgeRaw.split(" ")
const icon = isMultiWord const icon = isMultiWord ? simpleIcon.Get(words[0]) : simpleIcon.Get(badgeRaw)
? simpleIcon.Get(words[0])
: simpleIcon.Get(badgeRaw)
const color = tinycolor(icon.hex).lighten(5).desaturate(5) const color = tinycolor(icon.hex).lighten(5).desaturate(5)

View file

@ -7,13 +7,8 @@ import { map } from ".."
import { DataToPass } from "." import { DataToPass } from "."
export default function parsePost(data: DataToPass): void { export default function parsePost(data: DataToPass): void {
const { const { urlPath, markdownRaw, markdownData, humanizedDuration, totalWords } =
urlPath, data
markdownRaw,
markdownData,
humanizedDuration,
totalWords,
} = data
const postData: PostData = { const postData: PostData = {
title: markdownData.title as string, title: markdownData.title as string,

View file

@ -114,8 +114,7 @@ export default function parseSeries(data: DataToPass): void {
) )
) )
if (isNaN(index)) if (isNaN(index)) throw Error(`Invalid series index at: ${path}`)
throw Error(`Invalid series index at: ${path}`)
const itemToPush = { const itemToPush = {
index: index, index: index,

View file

@ -21,8 +21,7 @@ export function path2URL(pathToConvert: string): string {
*/ */
export function path2FileOrFolderName(inputPath: string): string { export function path2FileOrFolderName(inputPath: string): string {
// remove trailing slash // remove trailing slash
if (inputPath[-1] == "/") if (inputPath[-1] == "/") inputPath = inputPath.slice(0, inputPath.length - 1)
inputPath = inputPath.slice(0, inputPath.length - 1)
// get the last section // get the last section
return inputPath.slice(inputPath.lastIndexOf("/") + 1) return inputPath.slice(inputPath.lastIndexOf("/") + 1)

View file

@ -9,5 +9,7 @@ badges:
# - cairo # - cairo
--- ---
## Intro
Pomky is a [conky](https://github.com/brndnmtthws/conky)-like system monitor written in rust. Pomky is a [conky](https://github.com/brndnmtthws/conky)-like system monitor written in rust.
It is built to teach myself the rust programming language and to write a more flexible, efficient, and tailored version of conky. It is built to teach myself the rust programming language and to write a more flexible, efficient, and tailored version of conky.

View file

@ -91,10 +91,7 @@ const App = () => {
<Loading /> <Loading />
) : ( ) : (
<Routes> <Routes>
<Route <Route path="/" element={<PostList howMany={5} title="Home" />} />
path="/"
element={<PostList howMany={5} title="Home" />}
/>
<Route path="/search" element={<Search />} /> <Route path="/search" element={<Search />} />
<Route path="/portfolio" element={<Portfolio />} /> <Route path="/portfolio" element={<Portfolio />} />
<Route path="/404" element={<NotFound />} /> <Route path="/404" element={<NotFound />} />

View file

@ -27,9 +27,7 @@ const StyledSVG = styled.div<{ isDark: boolean }>`
svg { svg {
height: 16px; height: 16px;
fill: ${(props) => fill: ${(props) =>
props.isDark props.isDark ? theming.dark.color1 : theming.light.color1} !important;
? theming.dark.color1
: theming.light.color1} !important;
} }
` `

View file

@ -87,9 +87,7 @@ const ReadProgress = () => {
const b = document.body const b = document.body
// https://stackoverflow.com/a/8028584/12979111 // https://stackoverflow.com/a/8028584/12979111
setScroll( setScroll(((h[st] || b[st]) / ((h[sh] || b[sh]) - h.clientHeight)) * 100)
((h[st] || b[st]) / ((h[sh] || b[sh]) - h.clientHeight)) * 100
)
} }
window.addEventListener("scroll", scrollHandler) window.addEventListener("scroll", scrollHandler)
@ -107,9 +105,7 @@ const Navbar = () => {
<StyledNav> <StyledNav>
<StyledContainer> <StyledContainer>
<Link to="/"> <Link to="/">
<StyledImg <StyledImg src={process.env.PUBLIC_URL + "/icon/icon_circle.svg"} />
src={process.env.PUBLIC_URL + "/icon/icon_circle.svg"}
/>
</Link> </Link>
<StyledNavLinks> <StyledNavLinks>

View file

@ -58,9 +58,7 @@ const PostCard = (props: Props) => {
return ( return (
<StyledPostCard <StyledPostCard
onClick={() => onClick={() => navigate(process.env.PUBLIC_URL + props.postData.url)}
navigate(process.env.PUBLIC_URL + props.postData.url)
}
> >
<StyledTitle>{props.postData?.title || "No title"}</StyledTitle> <StyledTitle>{props.postData?.title || "No title"}</StyledTitle>
@ -70,12 +68,7 @@ const PostCard = (props: Props) => {
<TagList direction="left"> <TagList direction="left">
{props.postData.tags && {props.postData.tags &&
props.postData.tags.map((tag) => { props.postData.tags.map((tag) => {
return ( return <Tag key={props.postData.title + tag} text={tag} />
<Tag
key={props.postData.title + tag}
text={tag}
/>
)
})} })}
</TagList> </TagList>
<hr /> <hr />

View file

@ -89,10 +89,7 @@ const Sidebar = () => {
return ( return (
<> <>
<StyledOverlay <StyledOverlay isSidebarOpen={isSidebarOpen} onClick={toggleSidebar} />
isSidebarOpen={isSidebarOpen}
onClick={toggleSidebar}
/>
<StyledToggleSidebarButton <StyledToggleSidebarButton
data-tip data-tip

View file

@ -25,16 +25,10 @@ const Navbar = () => {
data-tip data-tip
data-for="theme" data-for="theme"
className="right" className="right"
onClick={() => onClick={() => setTheme(currentTheme === "dark" ? "light" : "dark")}
setTheme(currentTheme === "dark" ? "light" : "dark")
}
> >
{currentTheme == "dark" && ( {currentTheme == "dark" && <FontAwesomeIcon icon={faMoon} />}
<FontAwesomeIcon icon={faMoon} /> {currentTheme == "light" && <FontAwesomeIcon icon={faSun} />}
)}
{currentTheme == "light" && (
<FontAwesomeIcon icon={faSun} />
)}
</StyledThemeButton> </StyledThemeButton>
{!isMobile && ( {!isMobile && (
<ReactTooltip id="theme" type="dark" effect="solid"> <ReactTooltip id="theme" type="dark" effect="solid">

View file

@ -48,9 +48,7 @@ const Toc = (props: { data?: string }) => {
> >
<strong> <strong>
Table of Contents{" "} Table of Contents{" "}
<FontAwesomeIcon <FontAwesomeIcon icon={isTocOpened ? faCaretUp : faCaretDown} />
icon={isTocOpened ? faCaretUp : faCaretDown}
/>
</strong> </strong>
</StyledTocToggleButton> </StyledTocToggleButton>
<StyledCollapseContainer> <StyledCollapseContainer>

View file

@ -95,8 +95,7 @@ const Page = () => {
} }
case PageType.SERIES: { case PageType.SERIES: {
if (!(url.slice(0, url.lastIndexOf("/")) in map.series)) if (!(url.slice(0, url.lastIndexOf("/")) in map.series)) show404 = true
show404 = true
break break
} }
@ -182,9 +181,7 @@ const Page = () => {
pageData.seriesHome = seriesURL pageData.seriesHome = seriesURL
pageData.prev = pageData.prev =
prev >= 0 prev >= 0 ? map.series[seriesURL].order[prev] : undefined
? map.series[seriesURL].order[prev]
: undefined
pageData.next = pageData.next =
next < map.series[seriesURL].order.length next < map.series[seriesURL].order.length
? map.series[seriesURL].order[next] ? map.series[seriesURL].order[next]
@ -195,9 +192,7 @@ const Page = () => {
case PageType.PORTFOLIO_PROJECT: { case PageType.PORTFOLIO_PROJECT: {
const data = const data =
portfolio.projects[ portfolio.projects[url as keyof typeof portfolio.projects]
url as keyof typeof portfolio.projects
]
pageData.content = fetched_content.content pageData.content = fetched_content.content
pageData.toc = fetched_content.toc pageData.toc = fetched_content.toc
@ -246,10 +241,7 @@ const Page = () => {
<MainContent> <MainContent>
{/* next/previous series post buttons */} {/* next/previous series post buttons */}
{pageType == PageType.SERIES && ( {pageType == PageType.SERIES && (
<NextPrevButtons <NextPrevButtons prevURL={pageData.prev} nextURL={pageData.next} />
prevURL={pageData.prev}
nextURL={pageData.next}
/>
)} )}
{pageType == PageType.PORTFOLIO_PROJECT && ( {pageType == PageType.PORTFOLIO_PROJECT && (
@ -262,9 +254,7 @@ const Page = () => {
</StyledTitle> </StyledTitle>
{pageType == PageType.PORTFOLIO_PROJECT && {pageType == PageType.PORTFOLIO_PROJECT &&
pageData.badges.map((badge) => ( pageData.badges.map((badge) => <Badge key={badge} slug={badge} />)}
<Badge key={badge} slug={badge} />
))}
<small> <small>
{/* Post tags */} {/* Post tags */}
@ -294,10 +284,7 @@ const Page = () => {
<Toc data={pageData.toc} /> <Toc data={pageData.toc} />
{pageType == PageType.PORTFOLIO_PROJECT && ( {pageType == PageType.PORTFOLIO_PROJECT && (
<ProjectImage <ProjectImage src={pageData.image} alt="project example image" />
src={pageData.image}
alt="project example image"
/>
)} )}
{/* page content */} {/* page content */}

View file

@ -33,9 +33,7 @@ const ProjectCard = (props: ProjectCardProps) => {
const navigate = useNavigate() const navigate = useNavigate()
useEffect(() => { useEffect(() => {
setBadges( setBadges(project.badges.map((badge) => <Badge key={badge} slug={badge} />))
project.badges.map((badge) => <Badge key={badge} slug={badge} />)
)
}, []) }, [])
return ( return (

View file

@ -52,10 +52,7 @@ const Portfolio = () => {
property="og:image" property="og:image"
content="http://developomp.com/icon/icon.svg" content="http://developomp.com/icon/icon.svg"
/> />
<meta <meta property="og:description" content="developomp's Portfolio" />
property="og:description"
content="developomp's Portfolio"
/>
</Helmet> </Helmet>
<MainContent> <MainContent>

View file

@ -50,10 +50,7 @@ const PostList = (props: Props) => {
postCount++ postCount++
const url: string = map.date[date][length - i - 1] const url: string = map.date[date][length - i - 1]
_postCards.push( _postCards.push(
<PostCard <PostCard key={url} postData={{ url: url, ...map.posts[url] }} />
key={url}
postData={{ url: url, ...map.posts[url] }}
/>
) )
} }
} }

View file

@ -81,8 +81,7 @@ const TagSelect = (props: TagSelectProps) => {
":hover": { ":hover": {
backgroundColor: theming backgroundColor: theming
.theme(currentTheme.currentTheme, { .theme(currentTheme.currentTheme, {
light: theming.light light: theming.light.backgroundColor0,
.backgroundColor0,
dark: theming.dark.backgroundColor0, dark: theming.dark.backgroundColor0,
}) })
.toString(), .toString(),
@ -96,13 +95,10 @@ const TagSelect = (props: TagSelectProps) => {
dark: theming.dark.backgroundColor1, dark: theming.dark.backgroundColor1,
}) })
.toString(), .toString(),
border: theming.theme( border: theming.theme(currentTheme.currentTheme, {
currentTheme.currentTheme,
{
light: "1px solid #ccc", light: "1px solid #ccc",
dark: "1px solid #555", dark: "1px solid #555",
} }),
),
}), }),
multiValue: (styles) => ({ multiValue: (styles) => ({
...styles, ...styles,

View file

@ -114,15 +114,11 @@ const Search = () => {
for (const [key, value] of URLSearchParams.entries()) { for (const [key, value] of URLSearchParams.entries()) {
switch (key) { switch (key) {
case "date_from": case "date_from":
setDateRange((prev) => [ setDateRange((prev) => [{ ...prev[0], startDate: new Date(value) }])
{ ...prev[0], startDate: new Date(value) },
])
break break
case "date_to": case "date_to":
setDateRange((prev) => [ setDateRange((prev) => [{ ...prev[0], endDate: new Date(value) }])
{ ...prev[0], endDate: new Date(value) },
])
break break
case "tags": case "tags":
@ -258,17 +254,12 @@ const Search = () => {
value={searchInput} value={searchInput}
autoComplete="off" autoComplete="off"
placeholder="Search" placeholder="Search"
onChange={(event) => onChange={(event) => setSearchInput(event.target.value)}
setSearchInput(event.target.value)
}
onKeyPress={(event) => { onKeyPress={(event) => {
event.key === "Enter" && event.key === "Enter" && searchInput && doSearch()
searchInput &&
doSearch()
}} }}
/> />
{postCards.length}{" "} {postCards.length} {postCards.length > 1 ? "results" : "result"}
{postCards.length > 1 ? "results" : "result"}
<TagSelect <TagSelect
defaultValue={selectedTags} defaultValue={selectedTags}
onChange={(newValue) => { onChange={(newValue) => {