Skip to content

Commit 754a6b5

Browse files
committed
feat(content): display my latest posts on medium
1 parent d46b710 commit 754a6b5

24 files changed

+44
-223
lines changed

components/Latest.tsx

Lines changed: 7 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,27 @@
11
import React, { useState } from "react";
22
import SectionTitle from "./common/SectionTitle";
33
import me from "../json/me.json";
4-
import Video, { VideoType } from "./Video";
5-
import Modal from "./common/Modal";
64
import Button from "./common/Button";
7-
import YouTubeIcon from "@mui/icons-material/YouTube";
8-
import CancelIcon from "@mui/icons-material/Cancel";
9-
import { IconButton } from "@mui/material";
10-
import { Box } from "@mui/system";
11-
12-
const Latest = () => {
13-
const [currVideo, setCurrVideo] = useState<VideoType | null>(null);
14-
const [showMore, setShowMore] = useState<boolean>(false);
5+
import Post, { IPost } from "./Post";
156

7+
const LatestContent = () => {
168
return (
179
<section className="min-h-screen mb-20">
1810
<SectionTitle
1911
prefix="Latest"
2012
focus="content"
21-
subtitle="tips, insights, and best practices about web developpment and personal life"
13+
subtitle="tips, insights, and best practices about software engineering and personal life"
2214
/>
2315

2416
<div className="grid grid-cols-12 gap-y-10 md:gap-10 max-w-screen-lg mx-4 lg:mx-auto">
25-
{me.content.videos.slice(0, me.content.videosCutOff).map((v) => (
26-
<div
27-
className="col-span-12 md:col-span-6"
28-
key={v.title}
29-
onClick={() => setCurrVideo(v)}
30-
>
31-
<Video video={v} />
17+
{me.content.posts.map((post: IPost) => (
18+
<div className="relative w-full col-span-4" key={post.image}>
19+
<Post post={post} />
3220
</div>
3321
))}
3422
</div>
35-
36-
{showMore && (
37-
<div className="grid grid-cols-12 mt-10 gap-y-10 md:gap-10 max-w-screen-lg mx-4 lg:mx-auto">
38-
{me.content.videos.slice(me.content.videosCutOff).map((v) => (
39-
<div
40-
className="col-span-12 md:col-span-6"
41-
key={v.title}
42-
onClick={() => setCurrVideo(v)}
43-
>
44-
<Video video={v} />
45-
</div>
46-
))}
47-
</div>
48-
)}
49-
50-
<Box className="flex items-center justify-center mt-10">
51-
<Button
52-
variant="secondary"
53-
onClick={() => {
54-
setShowMore(!showMore);
55-
}}
56-
>
57-
{showMore ? "Show less" : "Show more"}
58-
</Button>
59-
</Box>
60-
61-
{currVideo !== null && (
62-
<Modal open onClose={() => setCurrVideo(null)}>
63-
<iframe
64-
className="w-full h-300 md:h-450 inline-block bg-gray-900"
65-
src={`https://www.youtube.com/embed/${currVideo.videoId}`}
66-
title={currVideo.title}
67-
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
68-
/>
69-
<div className="flex items-center justify-between mt-4">
70-
<h1 className="text-xl md:text-4xl font-semibold text-indigo-500">
71-
{currVideo.title}
72-
</h1>
73-
<IconButton onClick={() => setCurrVideo(null)} className="p-0">
74-
<CancelIcon className="text-indigo-500" />
75-
</IconButton>
76-
</div>
77-
<p className="text-gray-400 mt-2 lg:pr-28 leading-relaxed">
78-
{currVideo.description}
79-
</p>
80-
81-
<Button
82-
variant="primary"
83-
className="mt-8"
84-
onClick={() =>
85-
window.open(
86-
`https://www.youtube.com/watch?v=${currVideo.videoId}`
87-
)
88-
}
89-
iconStart={<YouTubeIcon />}
90-
>
91-
Watch on Youtube
92-
</Button>
93-
</Modal>
94-
)}
9523
</section>
9624
);
9725
};
9826

99-
export default Latest;
27+
export default LatestContent;

components/Post.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from "react";
2+
import { Box } from "@mui/material";
3+
4+
export type IPost = {
5+
image: string;
6+
url: string;
7+
};
8+
9+
const Post: React.FC<{ post: IPost }> = ({ post }) => {
10+
return (
11+
<div className="hover:scale-105 cursor-pointer transition-transform shadow-xl hover:shadow-2xl">
12+
<a href={post.url} target="_blank" rel="noopener noreferrer">
13+
<Box
14+
component="img"
15+
className="inline-block overflow-hidden rounded-md"
16+
src={post.image}
17+
alt="Post preview"
18+
/>
19+
</a>
20+
</div>
21+
);
22+
};
23+
24+
export default Post;

components/Video.tsx

Lines changed: 0 additions & 60 deletions
This file was deleted.

json/me.json

Lines changed: 13 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,6 @@
4646
"urlAsText": "linkedin.com/in/neuodev/"
4747
}
4848
],
49-
"contact": [
50-
{
51-
"label": "Email",
52-
"id": "email",
53-
"value": "[email protected]"
54-
},
55-
{
56-
"label": "Phone",
57-
"id": "whatsapp",
58-
"value": "+20 01552832217"
59-
}
60-
],
6149
"experiences": [
6250
{
6351
"company": {
@@ -157,88 +145,29 @@
157145
}
158146
],
159147
"content": {
160-
"videosCutOff": 4,
161-
"videos": [
162-
{
163-
"title": "But How JavaScript Actually Works ?!",
164-
"thumbnail": "/thumbnails/how-js-works.png",
165-
"description": "In this video, I will explain how JavaScript actually works. This includes explaining fundamental concepts in JavaScript like the Call Stack, Callback Queue, WebAPI, and Event Loop,...",
166-
"videoId": "NxhkaN2klUg"
167-
},
168-
{
169-
"title": "Fetch API Clearly Explained",
170-
"thumbnail": "/thumbnails/fetch-api.png",
171-
"description": "In this video, I will talk about the Fetch API and the underlying HTTP Protocol, and how the frontend interacts with the server. All of these with in-depth detailed examples to make sure you understand the concepts on a deeper level",
172-
"videoId": "WLXZYM6Dk9Q"
173-
},
174-
{
175-
"title": "The Ultimate Guide to JS \"This\" Keyword",
176-
"thumbnail": "/thumbnails/this-keyword.png",
177-
"description": "In this video, I am talking about one of the confusing topics in JavaScript. I discussed where the confusing natures of the \"this\" keyword come from and various use cases.",
178-
"videoId": "0gz0Wmi1gEg"
179-
},
180-
{
181-
"title": "Why should you have your own server?",
182-
"thumbnail": "/thumbnails/why-should-you-have-your-own-server.png",
183-
"description": "In this video I am taking about why me and you should have our own server. Server at not just made for production! We can do more with it!",
184-
"videoId": "F4FSwM1oxhw"
185-
},
186-
{
187-
"title": "Why should you learn rust?",
188-
"thumbnail": "/thumbnails/why-should-you-learn-rust.png",
189-
"description": "In this video I am sharing my personal reason for learning Rust why should everyone else should consider learning Rust",
190-
"videoId": "XJf615CfJXE"
191-
},
192-
{
193-
"title": "Vim Masterclas course review",
194-
"thumbnail": "/thumbnails/vim-mastery-course-review.png",
195-
"description": "In this video I am reviewing the famouse course from Udemy about the tool that changed how I write my code",
196-
"videoId": "6gHXQ8XE0J8"
197-
},
198-
{
199-
"title": "Bash mastery class course review",
200-
"thumbnail": "/thumbnails/bash-course-review.png",
201-
"description": "A review for the famous BASH mastery course on Udemy",
202-
"videoId": "uLHggJC00PI"
203-
},
204-
{
205-
"title": "Best resources to learn rust",
206-
"thumbnail": "/thumbnails/best-resources-to-learn-rust.png",
207-
"description": "A quick video for people who are welling to learn rust but doesn't know where to start",
208-
"videoId": "wCqMRKUBN_M"
209-
},
148+
"contentCutOff": 4,
149+
"posts": [
210150
{
211-
"title": "How to aquire new skills?",
212-
"thumbnail": "/thumbnails/how-to-aquire-new-skills.png",
213-
"description": "In this video I am sharing my own methods and techniques for aquiring new skills in most effcient way",
214-
"videoId": "ht0isWbUhh8"
151+
"image": "images/story_5.jpg",
152+
"url": "https://blog.ahmedibrahim.dev/how-i-get-myself-started-doing-hard-things-when-i-dont-want-to-4141e8538cfe"
215153
},
216154
{
217-
"title": "How to boost your productivity?",
218-
"thumbnail": "/thumbnails/how-to-boost-your-productvity.png",
219-
"description": "In this video I am sharing my own thoughts on what makes someone PRODUCTIVE",
220-
"videoId": "topmycLwhGE"
155+
"image": "images/story_4.jpg",
156+
"url": "https://blog.ahmedibrahim.dev/my-islamic-morning-routine-as-a-software-engineer-working-from-home-ced36311cd51"
221157
},
222158
{
223-
"title": "How to plan for your life?",
224-
"thumbnail": "/thumbnails/how-to-plan-for-your-life.png",
225-
"description": "In this video I am sharing my own way for putting a new plan and complete it end to end",
226-
"videoId": "ITZtvSlAljU"
159+
"image": "images/story_3.jpg",
160+
"url": "https://blog.ahmedibrahim.dev/how-a-single-ted-video-changed-my-life-e47689ed5717"
227161
},
228162
{
229-
"title": "How to put your daily plan?",
230-
"thumbnail": "/thumbnails/how-to-put-a-daily-plan.png",
231-
"description": "Learn how to get the most out of your day",
232-
"videoId": "video"
163+
"image": "images/story_2.jpg",
164+
"url": "https://blog.ahmedibrahim.dev/my-principles-of-losing-and-keeping-weight-after-a-decade-of-research-87b3d20543de"
233165
},
234166
{
235-
"title": "How to set the right goals?",
236-
"thumbnail": "/thumbnails/how-to-set-the-right-goals.png",
237-
"description": "In this video I am taking about my own way for setting my goals",
238-
"videoId": "m6-1Mi0YkEo"
167+
"image": "images/story_1.jpg",
168+
"url": "https://blog.ahmedibrahim.dev/my-mind-wasnt-prepared-to-start-a-blog-but-now-it-is-36a6843a97f5"
239169
}
240-
],
241-
"posts": null
170+
]
242171
},
243172
"projects": [
244173
{

public/images/ahmed.jpg

-43.9 KB
Binary file not shown.

public/images/hero.jpg

-461 KB
Binary file not shown.

public/images/story_1.jpg

147 KB
Loading

public/images/story_2.jpg

170 KB
Loading

public/images/story_3.jpg

142 KB
Loading

public/images/story_4.jpg

171 KB
Loading

0 commit comments

Comments
 (0)