Skip to content

Commit

Permalink
Add direction and item_style attributes to sections
Browse files Browse the repository at this point in the history
  • Loading branch information
thevahidal committed Dec 30, 2023
1 parent c9fe163 commit 2017992
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Each section has the following components:

- `title`: The title of the section (e.g., "Projects")
- `description`: A brief description of the section (e.g., "Here are some of my projects")
- `direction`: The direction of the section: "row" or "column" (e.g., "row")
- `item_style`: The style of the items in the section: "outline" or "filled" (e.g., "outline")
- `items`: The items associated with the section. Each item is defined using `[[sections.items]]`.

Each item within a section has the following components:
Expand Down
10 changes: 10 additions & 0 deletions data.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ gtag_id = "G-33WB8LVHR6"
[[sections]]
title = "Movies"
description = "Here are some of my movies"
direction = "column"
item_style = "outline"
[[sections.items]]
title = "Nightcrawler"
description = "A mesmerizing thriller delving into the dark world of crime journalism"
Expand All @@ -26,9 +28,17 @@ url = "https://www.imdb.com/title/tt1392214/"
[[sections]]
title = "Links"
description = "Look for me on these websites"
direction = "row"
item_style = "filled"
[[sections.items]]
title = "Instagram"
url = "https://www.instagram.com/jakegyllenhaal"
[[sections.items]]
title = "IMDb"
url = "https://www.imdb.com/name/nm0350453/"
[[sections.items]]
title = "Wikipedia"
url = "https://en.wikipedia.org/wiki/Jake_Gyllenhaal"
[[sections.items]]
title = "Rotten Tomatoes"
url = "https://www.rottentomatoes.com/celebrity/jake_gyllenhaal"
8 changes: 8 additions & 0 deletions dist/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
margin-bottom: var(--block-spacing-vertical);
}

.items {
display: flex;
column-gap: var(--spacing);
align-items: center;
justify-content: center;
flex-wrap: wrap;
}

[role="button"] > hgroup {
margin-bottom: 0;
}
Expand Down
20 changes: 12 additions & 8 deletions script.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@
h("h3")(section.get("title")),
h("p")(section.get("description")),
),
(
h("div", klass="item")(
h(
"div",
klass="items",
style=f"flex-direction: {section.get('direction', 'column')}",
)(
h(
"div",
klass="item",
style=f"width: {'100%' if section.get('direction', 'column') == 'column' else 'unset'}",
)(
h(
"a",
role="button",
klass="outline",
klass=f"{'outline' if section.get('item_style', 'outline') == 'outline' else ''}",
href=item.get("url"),
target="_blank",
)(
h("hgroup")(
h("h4")(item.get("title")),
h("h5")(item.get("description"))
if item.get("description")
else None,
"",
h("h4")(item.get("title")), h("h5")(item.get("description"))
),
),
)
Expand Down

0 comments on commit 2017992

Please sign in to comment.