Skip to content

Commit

Permalink
0.3.3 배포 (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
doputer authored Dec 10, 2022
2 parents 953500c + 1e5bece commit 6dc2cfb
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 13 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/sitemap-ping.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Sitemap Ping Schedule

on:
schedule:
- cron: '0 0 * * *'

jobs:
cron:
name: Cron

runs-on: ubuntu-latest

steps:
- run: curl https://www.google.com/ping\?sitemap\=https://www.knoticle.app/sitemap.xml
5 changes: 5 additions & 0 deletions frontend/components/common/Content/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ export const ContentBody = styled.div`
margin: 16px 0 8px 0;
}
ol,
ul {
padding-left: 16px;
}
ol {
list-style-type: decimal;
}
Expand Down
6 changes: 6 additions & 0 deletions frontend/components/search/ArticleItem/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ export const ItemGroup = styled.div`

export const ItemTitle = styled(TextMedium)`
margin-bottom: 16px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
`;

export const ItemContent = styled(TextSmall)`
word-break: break-all;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
Expand Down
4 changes: 1 addition & 3 deletions frontend/components/viewer/ArticleContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ export default function Article({
{!article.deleted_at ? (
<ArticleMain>
<ArticleContentsWrapper>
<ArticleTitle>
<TextLarge>{article.title}</TextLarge>
</ArticleTitle>
<ArticleTitle>{article.title}</ArticleTitle>
<Content content={article.content} />
</ArticleContentsWrapper>

Expand Down
4 changes: 3 additions & 1 deletion frontend/components/viewer/ArticleContent/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ export const ArticleMain = styled(Flex)`
padding: 50px 16px;
}
`;
export const ArticleTitle = styled.div`
export const ArticleTitle = styled.h1`
width: 100%;
border-bottom: 1px solid black;
padding: 25px 0;
text-align: left;
font-size: 24px;
font-weight: 700;
`;
export const ArticleTitleBtnBox = styled(Flex)`
flex-wrap: wrap;
Expand Down
29 changes: 20 additions & 9 deletions frontend/pages/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function Search() {
const [isArticleNoResult, setIsArticleNoResult] = useState(false);
const [isBookNoResult, setIsBookNoResult] = useState(false);

const highlightWord = (text: string, words: string[]): React.ReactNode => {
const highlightWord = (text: string, words: string[], isFirst = false): React.ReactNode => {
let wordIndexList = words.map((word) => text.toLowerCase().indexOf(word.toLowerCase()));

const filteredWords = words.filter((_, index) => wordIndexList[index] !== -1);
Expand All @@ -51,11 +51,19 @@ export default function Search() {

const endIndex = startIndex + targetWord.length;

let paddingIndex = 0;

if (isFirst) {
const regex = /(<([^>]+)>)/g;

while (regex.test(text.slice(0, startIndex))) paddingIndex = regex.lastIndex;
}

return (
<>
{text.slice(0, startIndex)}
{text.slice(paddingIndex, startIndex)}
<b>{text.slice(startIndex, endIndex)}</b>
{highlightWord(text.slice(endIndex), words)}
{highlightWord(text.slice(endIndex).replace(/(<([^>]+)>)/gi, ''), words)}
</>
);
};
Expand Down Expand Up @@ -134,15 +142,15 @@ export default function Search() {
setIsArticleNoResult(false);

const newArticlesHighlighted = newArticles.data.map((article: IArticle) => {
const keywords = debouncedKeyword.trim().split(' ');
const keywords = debouncedKeyword
.trim()
.split(' ')
.filter((word: string) => word);

return {
...article,
title: highlightWord(article.title, keywords),
content: highlightWord(
article.content.slice(0, 400).replace(/(<([^>]+)>)/gi, ''),
keywords
),
content: highlightWord(article.content, keywords, true),
};
});

Expand All @@ -167,7 +175,10 @@ export default function Search() {
setIsBookNoResult(false);

const newBooksHighlighted = newBooks.data.map((book: IBook) => {
const keywords = debouncedKeyword.trim().split(' ');
const keywords = debouncedKeyword
.trim()
.split(' ')
.filter((word: string) => word);

return {
...book,
Expand Down

0 comments on commit 6dc2cfb

Please sign in to comment.