웹 페이지 프론트엔드 UI 수정
- 모바일에서 봤을 때 UI/UX 이상하고 불편했던 부분 수정 - 블로그 글 모바일 크기 시 리스트 아래로 글이 내려가는 부분 수정 - 전체 배경 이어 붙이기가 아닌 고정으로 스크롤 시에도 어색하지 않게 수정
This commit is contained in:
@@ -53,6 +53,29 @@
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.blog-toggle-list {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 20px;
|
||||
left: 20px;
|
||||
z-index: 1000;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid var(--line);
|
||||
background: rgba(10, 12, 20, 0.8);
|
||||
color: var(--text);
|
||||
font-size: 18px;
|
||||
cursor: pointer;
|
||||
backdrop-filter: blur(10px);
|
||||
transition: transform 0.2s ease, opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.blog-toggle-list:hover {
|
||||
transform: scale(1.1);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.blog-list {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
@@ -184,7 +207,10 @@
|
||||
|
||||
.blog-article__body h1,
|
||||
.blog-article__body h2,
|
||||
.blog-article__body h3 {
|
||||
.blog-article__body h3,
|
||||
.blog-article__body h4,
|
||||
.blog-article__body h5,
|
||||
.blog-article__body h6 {
|
||||
font-family: var(--font-display);
|
||||
margin: 22px 0 10px;
|
||||
}
|
||||
@@ -201,6 +227,18 @@
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.blog-article__body h4 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.blog-article__body h5 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.blog-article__body h6 {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.md-paragraph {
|
||||
margin: 0 0 14px;
|
||||
color: var(--muted);
|
||||
@@ -220,6 +258,11 @@
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
.blog-article__body del {
|
||||
text-decoration: line-through;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.blog-article__body a {
|
||||
color: #f7d4c9;
|
||||
}
|
||||
@@ -325,4 +368,104 @@
|
||||
.blog-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.blog-toggle-list {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.blog-list {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.blog-list.is-visible {
|
||||
display: block;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(6, 8, 12, 0.7);
|
||||
z-index: 999;
|
||||
padding: 80px 20px 20px;
|
||||
overflow-y: auto;
|
||||
backdrop-filter: blur(10px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.blog-list.is-visible .blog-category-filter {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.blog-list.is-visible .blog-pagination {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.blog-article {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.blog-header h1 {
|
||||
font-size: clamp(24px, 6vw, 32px);
|
||||
}
|
||||
|
||||
.blog-grid {
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.blog-list {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.blog-list__item {
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.blog-list__title {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.blog-list__excerpt {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.blog-article {
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
.blog-article__body h1 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.blog-article__body h2 {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.blog-article__body h3 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.blog-article__body h4 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.blog-article__body h5 {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.blog-article__body h6 {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.blog-categories__grid {
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.blog-category-card {
|
||||
padding: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import './Blog.css';
|
||||
const renderInline = (text) => {
|
||||
const normalized = text.replace(/<br\s*\/?>/gi, '\n');
|
||||
const pattern =
|
||||
/(!\[[^\]]*\]\([^)]+\)|\[[^\]]+\]\([^)]+\)|\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`)/g;
|
||||
/(!\[[^\]]*\]\([^)]+\)|\[[^\]]+\]\([^)]+\)|\*\*[^*]+\*\*|\*[^*]+\*|~~[^~]+~~|`[^`]+`)/g;
|
||||
const segments = normalized.split('\n');
|
||||
|
||||
return segments.flatMap((segment, segmentIndex) => {
|
||||
@@ -48,6 +48,9 @@ const renderInline = (text) => {
|
||||
if (part.startsWith('*')) {
|
||||
return <em key={`${part}-${index}`}>{part.replace(/\*/g, '')}</em>;
|
||||
}
|
||||
if (part.startsWith('~~')) {
|
||||
return <del key={`${part}-${index}`}>{part.replace(/~~/g, '')}</del>;
|
||||
}
|
||||
if (part.startsWith('`')) {
|
||||
return <code key={`${part}-${index}`}>{part.replace(/`/g, '')}</code>;
|
||||
}
|
||||
@@ -123,6 +126,18 @@ const renderMarkdown = (body) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (line.startsWith('###### ')) {
|
||||
blocks.push({ type: 'h6', value: line.replace(/^######\s+/, '') });
|
||||
return;
|
||||
}
|
||||
if (line.startsWith('##### ')) {
|
||||
blocks.push({ type: 'h5', value: line.replace(/^#####\s+/, '') });
|
||||
return;
|
||||
}
|
||||
if (line.startsWith('#### ')) {
|
||||
blocks.push({ type: 'h4', value: line.replace(/^####\s+/, '') });
|
||||
return;
|
||||
}
|
||||
if (line.startsWith('### ')) {
|
||||
blocks.push({ type: 'h3', value: line.replace(/^###\s+/, '') });
|
||||
return;
|
||||
@@ -146,6 +161,9 @@ const renderMarkdown = (body) => {
|
||||
if (block.type === 'h1') return <h1 key={index}>{block.value}</h1>;
|
||||
if (block.type === 'h2') return <h2 key={index}>{block.value}</h2>;
|
||||
if (block.type === 'h3') return <h3 key={index}>{block.value}</h3>;
|
||||
if (block.type === 'h4') return <h4 key={index}>{block.value}</h4>;
|
||||
if (block.type === 'h5') return <h5 key={index}>{block.value}</h5>;
|
||||
if (block.type === 'h6') return <h6 key={index}>{block.value}</h6>;
|
||||
if (block.type === 'list')
|
||||
return (
|
||||
<ul key={index}>
|
||||
@@ -202,6 +220,7 @@ const Blog = () => {
|
||||
|
||||
const [selectedCategory, setSelectedCategory] = useState('전체');
|
||||
const [page, setPage] = useState(1);
|
||||
const [showList, setShowList] = useState(false);
|
||||
const pageSize = 10;
|
||||
const filteredPosts = useMemo(() => {
|
||||
if (selectedCategory === '전체') return posts;
|
||||
@@ -250,7 +269,15 @@ const Blog = () => {
|
||||
</header>
|
||||
|
||||
<div className="blog-grid">
|
||||
<aside className="blog-list">
|
||||
<button
|
||||
type="button"
|
||||
className="blog-toggle-list"
|
||||
onClick={() => setShowList((prev) => !prev)}
|
||||
aria-label="글 목록 토글"
|
||||
>
|
||||
☰
|
||||
</button>
|
||||
<aside className={`blog-list ${showList ? 'is-visible' : ''}`}>
|
||||
<div className="blog-category-filter">
|
||||
{['전체', ...categoryNames, '기타'].map((name) => (
|
||||
<button
|
||||
@@ -272,7 +299,10 @@ const Blog = () => {
|
||||
className={`blog-list__item${
|
||||
post.slug === activeSlug ? ' is-active' : ''
|
||||
}`}
|
||||
onClick={() => setActiveSlug(post.slug)}
|
||||
onClick={() => {
|
||||
setActiveSlug(post.slug);
|
||||
setShowList(false); // 모바일에서 글 선택 시 리스트 숨김
|
||||
}}
|
||||
>
|
||||
<p className="blog-list__title">{post.title}</p>
|
||||
<p className="blog-list__excerpt">{post.excerpt}</p>
|
||||
|
||||
Reference in New Issue
Block a user