Skip to content

Commit 79c4921

Browse files
authored
add post-image (#49)
1 parent ada4dd1 commit 79c4921

6 files changed

Lines changed: 68 additions & 3 deletions

File tree

Lines changed: 1 addition & 0 deletions
Loading

app/content/posts/personal-website/dagger-io.mdx renamed to app/content/posts/personal-website/dagger-io/dagger-io.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ date: 2024-04-18
55
wip: true
66
---
77

8+
import { PostImage } from "@/components/molecues/post-image";
9+
import Landscape from "./assets/dagger-landscape.svg";
10+
11+
<PostImage src={Landscape} />
12+
813
I wanted to have the ability to run CI/CD pipelines on my local, and I decided to go with [Dagger.io](https://dagger.io/). It not only fed my need and also added a lot of instresting features. In this post I'll share how I added dagger.io to my personal website.
914

1015
## Requirements
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import Stack, { StackProps } from "@mui/material/Stack";
2+
import Typography from "@mui/material/Typography";
3+
import * as React from "react";
4+
5+
import { styles } from "./styles";
6+
7+
export type PostImageProps = Omit<
8+
StackProps<
9+
"div",
10+
{
11+
src: string;
12+
caption?: string | React.ReactNode;
13+
}
14+
>,
15+
"sx"
16+
>;
17+
18+
export const PostImage = ({ src, caption, ...cardProps }: PostImageProps) => {
19+
return (
20+
<Stack
21+
direction="column"
22+
css={styles.root}
23+
alignItems="center"
24+
spacing={1}
25+
{...cardProps}
26+
>
27+
<img
28+
css={styles.image}
29+
src={src}
30+
alt={typeof caption === "string" ? caption : undefined}
31+
/>
32+
{typeof caption === "string" ? (
33+
<Typography variant="caption">{caption}</Typography>
34+
) : (
35+
caption
36+
)}
37+
</Stack>
38+
);
39+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { css } from "@emotion/react";
2+
3+
import { AppTheme } from "@/theme";
4+
5+
export const styles = {
6+
root: (theme: AppTheme) =>
7+
css({
8+
marginBlockEnd: theme.spacing(4),
9+
width: "100%",
10+
}),
11+
12+
image: (theme: AppTheme) =>
13+
css({
14+
backgroundColor: theme.palette.augmentColor({
15+
color: {
16+
main: theme.palette.background.paper,
17+
},
18+
}).light,
19+
}),
20+
};

app/src/components/organisms/post-header/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ export const PostHeader = ({ title, date, ...stackProps }: PostHeaderProps) => {
2020
: "";
2121

2222
return (
23-
<Stack {...stackProps}>
23+
<Stack spacing={1} {...stackProps}>
24+
<Typography variant="caption">{formatterDate}</Typography>
2425
<Typography variant="h2">{title}</Typography>
25-
<Typography variant="subtitle1">{formatterDate}</Typography>
2626
</Stack>
2727
);
2828
};

app/src/providers/mdx-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const ul = (props: any) => (
5151

5252
const li = (props: any) => <li {...props} css={{}} />;
5353

54-
const a = (props: any) => <Link {...props} />;
54+
const a = (props: any) => <Link component="a" target="_blank" {...props} />;
5555

5656
const defaultComponents = {
5757
text,

0 commit comments

Comments
 (0)