Skip to content

Commit 144e198

Browse files
committed
feat: new blog page
1 parent 1c775f0 commit 144e198

File tree

6 files changed

+181
-50
lines changed

6 files changed

+181
-50
lines changed

src/components/content/blog/BlogCard.tsx

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { HiOutlineClock, HiOutlineEye } from 'react-icons/hi';
44

55
import Accent from '@/components/Accent';
66
import Tag from '@/components/content/Tag';
7-
import CloudinaryImg from '@/components/images/CloudinaryImg';
87
import UnstyledLink from '@/components/links/UnstyledLink';
98

109
import { BlogFrontmatter, InjectedMeta } from '@/types/frontmatters';
@@ -36,20 +35,36 @@ export default function BlogCard({
3635
className='block h-full rounded-md focus:outline-none focus-visible:ring focus-visible:ring-primary-300'
3736
href={`/blog/${post.slug}`}
3837
>
39-
<div className='relative'>
40-
<CloudinaryImg
41-
noStyle
42-
className='pointer-events-none overflow-hidden rounded-t-md'
43-
publicId={`banner/${post.banner}`}
44-
alt='Photo taken from unsplash'
45-
width={1200}
46-
height={(1200 * 2) / 5}
47-
aspect={{ height: 2, width: 5 }}
48-
preview={false}
49-
/>
38+
<div className='flex items-end p-4'>
39+
{/* blog_info */}
40+
<div className='w-full'>
41+
<h4 className='text-gray-800 dark:text-gray-100'>{post.title}</h4>
42+
<p className='mt-4 mb-2 text-sm text-gray-600 dark:text-gray-300'>
43+
<span className='font-bold text-gray-800 dark:text-gray-100'>
44+
{format(
45+
new Date(post.lastUpdated ?? post.publishedAt),
46+
'MMMM dd, yyyy'
47+
)}
48+
</span>
49+
</p>
50+
<p className='text-sm text-gray-700 dark:text-gray-300'>
51+
{post.description}
52+
</p>
53+
<div className='mt-2 flex items-center justify-start gap-2 text-sm font-medium text-gray-600 dark:text-gray-300'>
54+
<div className='flex items-center gap-1'>
55+
<HiOutlineClock className='inline-block text-base' />
56+
{post.readingTime.text}
57+
</div>
58+
<div className='flex items-center gap-1'>
59+
<HiOutlineEye className='inline-block text-base' />
60+
{post?.views?.toLocaleString() ?? '-'} views
61+
</div>
62+
</div>
63+
</div>
64+
{/* tags */}
5065
<div
5166
className={clsx(
52-
'absolute bottom-0 w-full px-4 py-2',
67+
'w-full px-4 py-2',
5368
'mt-2 flex flex-wrap justify-end gap-y-1 gap-x-2 text-sm text-black dark:text-gray-100'
5469
)}
5570
>
@@ -64,30 +79,6 @@ export default function BlogCard({
6479
))}
6580
</div>
6681
</div>
67-
<div className='p-4'>
68-
<h4 className='text-gray-800 dark:text-gray-100'>{post.title}</h4>
69-
<div className='mt-2 flex items-center justify-start gap-2 text-sm font-medium text-gray-600 dark:text-gray-300'>
70-
<div className='flex items-center gap-1'>
71-
<HiOutlineClock className='inline-block text-base' />
72-
{post.readingTime.text}
73-
</div>
74-
<div className='flex items-center gap-1'>
75-
<HiOutlineEye className='inline-block text-base' />
76-
{post?.views?.toLocaleString() ?? '-'} views
77-
</div>
78-
</div>
79-
<p className='mt-4 mb-2 text-sm text-gray-600 dark:text-gray-300'>
80-
<span className='font-bold text-gray-800 dark:text-gray-100'>
81-
{format(
82-
new Date(post.lastUpdated ?? post.publishedAt),
83-
'MMMM dd, yyyy'
84-
)}
85-
</span>
86-
</p>
87-
<p className='text-sm text-gray-700 dark:text-gray-300'>
88-
{post.description}
89-
</p>
90-
</div>
9182
</UnstyledLink>
9283
</li>
9384
);

src/components/layout/Icon.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { SiBilibili } from 'react-icons/si';
33

44
import ThemeButton from '@/components/buttons/ThemeButton';
55

6-
const Logo = () => {
6+
const Icon = () => {
77
return (
88
<div className='flex cursor-pointer gap-[24px] text-[22px]'>
99
<a
@@ -25,4 +25,4 @@ const Logo = () => {
2525
);
2626
};
2727

28-
export default Logo;
28+
export default Icon;

src/contents/blog/02-didi copy.mdx

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
title: '滴滴-橙心优选2'
3+
publishedAt: '2022-12-20'
4+
description: '滴滴-橙心优选前端秋招面试总结与复盘'
5+
banner: 'didi_l7o0am.jpg'
6+
tags: 'interview,vue,react'
7+
---
8+
9+
## 介绍
10+
11+
先说一下最终结果吧,第三面凉了。9 月 5 号下午 1 点开始,一直到下午 4 点 20 样子,持续三轮面试,最终倒在了第三轮。感受与总结我就放在最后吧。总体来说问的比较基础,没有深度挖掘知识点。另外,已经过了一天了,还是三面一起来的,可能会有问题遗漏掉,一般来说遗漏掉的都是比较简单,能轻松说出来的那种。
12+
13+
## 一面
14+
15+
- 1、自我介绍
16+
- 2、JS 基本数据类型(怎么判断基本数据类型)
17+
- 3、说说你对原型和原型链的理解
18+
- 4、水平垂直居中的几种方式,说一说
19+
- 5、说说你对深浅拷贝的理解(要求手撕深拷贝)
20+
- 6、输入一个 URL 到渲染页面的整个过程
21+
- 7、浏览器缓存有了解过嘛?说说看
22+
- 8、说一个你熟悉的排序算法,然后手写一下(简单写了一个冒泡)
23+
24+
### 感受
25+
26+
一面问的比较基础,也是比较顺利收到了二面通知
27+
28+
## 二面
29+
30+
- 1、自我介绍
31+
- 2、CSS 选择器优先级的理解
32+
- 3、CSS 定位的几种方式
33+
- 4、CSS 怎么清除浮动
34+
- 5、display 几种属性说一说
35+
- 6、水平垂直居中的几种方式
36+
- 7、父容器已知宽高,子容器宽高未知,怎样让子容器水平垂直居中
37+
- 8、css modules 你有了解过吗
38+
- 9、如果组件 css 命名冲突,你怎么解决
39+
- 10、设计模式你有了解过吗?说说单例模式
40+
- 11、call、apply、bind 的区别
41+
- 12、普通函数和箭头函数的区别
42+
- 13、项目中有用到 `debounce`,那你写一下防抖吧
43+
- 14、实现如下效果:当点击 `aaa` 时输出 0 ,当点击 `bbb` 输出 1,当点击`ccc` 输出 2
44+
45+
```javascript
46+
<ul>
47+
<li>aaa</li>
48+
<li>bbb</li>
49+
<li>ccc</li>
50+
</ul>
51+
```
52+
53+
- 15、for 遍历时,如果用 `var` 来声明变量 `i` 会有什么问题,怎么解决这个问题?
54+
- 16、浏览器缓存你了解多少,说说看
55+
- 17、谈谈你对 `cookie` 的理解,`cookie` 有哪些字段,说说看
56+
- 18、`cookie``session` 的区别
57+
58+
### 感受
59+
60+
感觉有些问题,答的不是很好,但过了二面,手撕那块没啥问题。
61+
62+
## 三面
63+
64+
- 1、自我介绍
65+
- 2、聊大学经历
66+
- 3、你觉得学的最好的一门课
67+
68+
> 因为网络这块知识准备的比较充足,就选了计算机网络,其它的与前端不太挂钩,也不太好扯。
69+
70+
- 4、面试官对网络这门课教学方式很感兴趣,于是扯了挺久,扯到了网络建设项目(校运动会举行),扯到了最后排名,与第一名的差距在哪
71+
- 5、如果要你给一个非科班的人,讲网络这门课,你会怎么讲?
72+
- 6、网络里面你认为的最熟悉的章节(说了 HTTP、TCP 这块)
73+
- 7、那你说一下对称加密和非对称加密。为什么非对称加密更好,现在还是有用对称加密,你能说出原因吗?最好举一下生活中的例子
74+
- 8、你算法和数据结构咋样,做一道题吧
75+
76+
> 上来就来了一道动态规划的题,想了一下,没啥思路,面试官就换了一道题
77+
78+
- 9、算法题:求两个数组的交集
79+
80+
### 感受
81+
82+
10 分钟后收到了感谢信,这效率是真高啊。原以为秋招以收到滴滴意向书结束,但没想到还是倒在了三面这最后一步了。收到后不甘心是当然的,但是面试后的复盘是很重要的,接下来写一下对本次面试的总结吧
83+
84+
## 总结
85+
86+
`我很强,但是我很傲。` 从下午 1 点开始面,一直面到下午 4 点 20 左右,也是我第一次经历。面试完后,都感觉脑袋空荡荡的,啥也记不起来了。开头这句话,是我收到面试结果后想到的一句话。`我很强`:这或许就是面试失败后对自己的安慰吧,我很强,不要因为这个丢失了信心。
87+
88+
`但是我很傲`:连面的过程是挺兴奋的,我从春招从未收到二面开始,到现在居然到了三面,就感觉离成功就差那么一步了。三面面完后,休息时间段期间,我甚至比较自信自己快要拿到滴滴意向书了。与实习公司同事还聊了一会,他们说自己也是聊天,聊着聊着就凉了。我还是对自己比较有信心,还例举了自己问了哪些问题。
89+
90+
世界就是这样,永远不要笑别人,因为保不准那天你就成了故事里的主人公,成为了被笑的那个。
91+
92+
没错,我也终究成为了那一个,甚至怀疑是不是弄错了,但过了一天后,复盘过后,发现确实有些地方没有到位。
93+
94+
至于这个 ``,我还去查了查狮子座男生性格特点:
95+
96+
> 在十二星座中,狮子座是最具有权威感与支配能力的星座。通常有一种贵族气息或是王者风范。受人尊重,做事相当独立,知道如何运用能力和权术以达到目的。本质是阳刚、钻制、具有太阳般的生气、宽宏大量、乐观、海派、光明磊落、不拘小节、心胸开阔。不过也会有顽固、傲慢、独裁的一面。同时,他们天生怀抱着崇高的理想,能够全力以赴、发挥旺盛的生命力为周遭的人、为弱者或正义而战。对弱者有慈悲心及同情心,对自己很有自信,擅长组织事务,喜欢有秩序;能够发挥创造的才华,使成果具有建设性、原创性,是个行动派。
97+
98+
在过去,可能对星座这一块不太了解,也不会相信所说的性格特点啥的,但是现在回过头来看,这些性格特点真差不了太多。
99+
100+
其实,这或许就是大家常在嘴边说起的年轻人吧,那种傲气,能力不够,简单事又不愿意做。
101+
102+
尽管这次面试依旧凉了,但还是继续努力,在这里整理一下 9 月份规划:
103+
104+
- 适当慢下来,整理复盘一下 8 月份面试出现的问题,及时查漏补缺
105+
- 亡羊补牢,将基础知识学的更扎实一点
106+
- 算法那一块也要坚持下去,保证让自己 9 月份刷完一轮专题路线
107+
108+
至于对于面试其它感受,在此就不继续书写了,因为看到的文章并不一定能体会到我的过程。就好像读者看到的是一张风景照片,但可能没法体验到沿途的风景的那段过程。
109+
110+
> 2020.9.6 晚有感而发,希望 9 月对自己更温柔一点。加油!

src/contents/blog/03 test copy.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: 'test2020'
3+
publishedAt: '2020-10-20'
4+
description: '滴滴-橙心优选前端秋招面试总结与复盘'
5+
tags: 'interview'
6+
---
7+
8+
## 介绍
9+
10+
先说一下最终结果吧,第三面凉了。9 月 5 号下午 1 点开始,一直到下午 4 点 20 样子,持续三轮面试,最终倒在了第三轮。感受与总结我就放在最后吧。总体来说问的比较基础,没有深度挖掘知识点。另外,已经过了一天了,还是三面一起来的,可能会有问题遗漏掉,一般来说遗漏掉的都是比较简单,能轻松说出来的那种。

src/contents/blog/03 test.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: 'test2020-2'
3+
publishedAt: '2020-10-20'
4+
description: '滴滴-橙面试总结与复盘'
5+
tags: 'interview'
6+
---
7+
8+
## 介绍
9+
10+
先说一下最终结果吧,第三面凉了。9 月 5 号下午 1 点开始,一直到下午 4 点 20 样子,持续三轮面试,最终倒在了第三轮。感受与总结我就放在最后吧。总体来说问的比较基础,没有深度挖掘知识点。另外,已经过了一天了,还是三面一起来的,可能会有问题遗漏掉,一般来说遗漏掉的都是比较简单,能轻松说出来的那种。

src/pages/blog.tsx

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,35 @@ export default function IndexPage({
1616
}: InferGetStaticPropsType<typeof getStaticProps>) {
1717
const isLoaded = useLoaded();
1818

19+
const getYear = (a: Date | string | number) => new Date(a).getFullYear();
20+
21+
const isSameYear = (a: Date | string | number, b: Date | string | number) =>
22+
a && b && getYear(a) === getYear(b);
23+
1924
return (
2025
<Layout>
2126
<Seo
2227
templateTitle='Blog'
2328
description='Thoughts, mental models, and tutorials about front-end development. Rebuild your mental model so front-end development can be predictable.'
2429
/>
25-
2630
<main>
27-
<section className={clsx(isLoaded && 'fade-in-start min-h-screen')}>
28-
<div className='layout mt-[60px] min-h-screen py-12'>
29-
<h1 className='text-5xl dark:text-gray-100' data-fade='0'>
30-
Blog
31-
</h1>
32-
<p className='mt-2 text-gray-600 dark:text-gray-300' data-fade='1'>
33-
Thoughts, skill, and tutorials about front-end development.
34-
</p>
35-
<ul className=' mt-12 grid grid-cols-3 gap-4' data-fade='2'>
31+
<section className={clsx(isLoaded && 'fade-in-start')}>
32+
<div className='layout'>
33+
<ul className='mx-8 mt-12 grid gap-4' data-fade='2'>
3634
{posts.length > 0 ? (
37-
posts.map((post) => <BlogCard key={post.slug} post={post} />)
35+
posts.map((post, index) => (
36+
<>
37+
{!isSameYear(
38+
post.publishedAt,
39+
posts[index - 1]?.publishedAt
40+
) && (
41+
<span className='text-[24px] text-[#aaa]'>
42+
{getYear(post.publishedAt)}
43+
</span>
44+
)}
45+
<BlogCard key={post.slug} post={post} />
46+
</>
47+
))
3848
) : (
3949
<ContentPlaceholder />
4050
)}

0 commit comments

Comments
 (0)