Basic cours support #44

Merged
Anri merged 67 commits from cours into main 2024-04-01 18:11:49 +02:00
9 changed files with 58 additions and 5 deletions
Showing only changes of commit da137c1988 - Show all commits

View file

@ -150,6 +150,7 @@ name: Option<String>
pronouns: Option<String> pronouns: Option<String>
avatar: Option<String> avatar: Option<String>
avatar_caption: Option<String> avatar_caption: Option<String>
avatar_style: Option<String>
--- ---
Index content Index content
@ -157,6 +158,7 @@ Index content
- If no `name`, the `fullname` used in the configuration will be used - If no `name`, the `fullname` used in the configuration will be used
- `avatar` is the link of the avatar - `avatar` is the link of the avatar
- `avatar_style` is either `round` (default) or `square`
## Blog ## Blog

View file

@ -56,6 +56,7 @@ pub struct FileMetadataIndex {
pub pronouns: Option<String>, pub pronouns: Option<String>,
pub avatar: Option<String>, pub avatar: Option<String>,
pub avatar_caption: Option<String>, pub avatar_caption: Option<String>,
pub avatar_style: Option<String>,
} }
/// Metadata for portfolio cards /// Metadata for portfolio cards

View file

@ -24,6 +24,13 @@ struct IndexTemplate {
content: Option<File>, content: Option<File>,
avatar: String, avatar: String,
avatar_caption: String, avatar_caption: String,
avatar_style: StyleAvatar,
}
#[derive(Content, Debug, Default)]
struct StyleAvatar {
round: bool,
square: bool,
} }
#[once(time = 60)] #[once(time = 60)]
@ -38,6 +45,10 @@ fn build_page(config: Config) -> String {
let mut pronouns = None; let mut pronouns = None;
let mut avatar = "/icons/apple-touch-icon.png".to_owned(); let mut avatar = "/icons/apple-touch-icon.png".to_owned();
let mut avatar_caption = "EWP avatar".to_owned(); let mut avatar_caption = "EWP avatar".to_owned();
let mut avatar_style = StyleAvatar {
round: true,
square: false,
};
if let Some(f) = &file { if let Some(f) = &file {
if let Some(m) = &f.metadata.info.index { if let Some(m) = &f.metadata.info.index {
@ -45,6 +56,15 @@ fn build_page(config: Config) -> String {
avatar = m.avatar.to_owned().unwrap_or(avatar); avatar = m.avatar.to_owned().unwrap_or(avatar);
pronouns = m.pronouns.to_owned(); pronouns = m.pronouns.to_owned();
avatar_caption = m.avatar_caption.to_owned().unwrap_or(avatar_caption); avatar_caption = m.avatar_caption.to_owned().unwrap_or(avatar_caption);
if let Some(style) = m.avatar_style.to_owned() {
if style.trim() == "square" {
avatar_style = StyleAvatar {
square: true,
..StyleAvatar::default()
}
}
}
} }
} else { } else {
file = read_file("README.md", TypeFileMetadata::Generic); file = read_file("README.md", TypeFileMetadata::Generic);
@ -62,6 +82,7 @@ fn build_page(config: Config) -> String {
pronouns, pronouns,
avatar, avatar,
avatar_caption, avatar_caption,
avatar_style,
}, },
Infos { Infos {
page_title: config.fc.fullname, page_title: config.fc.fullname,

BIN
static/badges/palestine.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -38,7 +38,6 @@
#avatar { #avatar {
width: calc(var(--font-size) * 5); width: calc(var(--font-size) * 5);
border-radius: 50%;
float: right; float: right;
} }

View file

@ -28,9 +28,13 @@ main ul:not(ul ul) {
/* breakpoint */ /* breakpoint */
@media only screen and (max-width: 740px) { @media only screen and (max-width: 740px) {
main ul { main ul:not(ul ul) {
grid-template-columns: none; grid-template-columns: none;
} }
main li:not(ul ul > li) {
grid-column: inherit !important;
}
} }
/* Card */ /* Card */
@ -50,6 +54,10 @@ main li:not(ul ul > li) {
margin-inline: 5px; margin-inline: 5px;
} }
main li:not(ul ul > li):nth-child(odd):last-child {
grid-column: span 2;
}
main li:hover:not(ul ul > li) { main li:hover:not(ul ul > li) {
background: color-mix(in srgb, var(--background) 40%, var(--extreme)); background: color-mix(in srgb, var(--background) 40%, var(--extreme));
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.3); box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.3);

View file

@ -14,7 +14,7 @@ window.addEventListener("load", () => {
new Tag("Étudiant qui va rater son master"), new Tag("Étudiant qui va rater son master"),
new Tag("Peak D2 sur Valo 🤡"), new Tag("Peak D2 sur Valo 🤡"),
new Tag( new Tag(
"1312", "0x520",
` `
display: inline; display: inline;
background: linear-gradient(to bottom right, red 0%, red 50%, black 50%); background: linear-gradient(to bottom right, red 0%, red 50%, black 50%);
@ -25,6 +25,7 @@ window.addEventListener("load", () => {
), ),
new Tag("Nul en CSS", "font-family: 'Comic Sans MS', cursive"), new Tag("Nul en CSS", "font-family: 'Comic Sans MS', cursive"),
new Tag("Mention poufiasse"), new Tag("Mention poufiasse"),
new Tag("anri k... caterpillar 🐛☝️"),
]; ];
const random = Math.round(Math.random() * (tags.length - 1)); const random = Math.round(Math.random() * (tags.length - 1));

View file

@ -3,12 +3,23 @@
<head dir="ltr"> <head dir="ltr">
{{>head.html}} {{>head.html}}
<link rel="stylesheet" href="/css/index.css" /> <link rel="stylesheet" href="/css/index.css" />
{{#data}} {{#avatar_style}} {{#round}}
<style>
#avatar {
border-radius: 50%;
}
</style>
{{/round}} {{#square}}
<style>
#avatar {
border-radius: 10%;
}
</style>
{{/square}} {{/avatar_style}}
</head> </head>
<body> <body>
<header>{{>navbar.html}}</header> <header>{{>navbar.html}}</header>
<main> <main>
{{#data}}
<div> <div>
<span id="name">{{name}}</span> <span id="name">{{name}}</span>
{{#pronouns}}<span id="pronouns">{{pronouns}}</span>{{/pronouns}} {{#pronouns}}<span id="pronouns">{{pronouns}}</span>{{/pronouns}}

View file

@ -264,6 +264,13 @@
title="We are humans" title="We are humans"
/></a> /></a>
<a target="_blank" href="https://decolonizepalestine.com"
><img
src="/badges/palestine.png"
alt="Stand with palestine"
title="a genocide is happening"
/></a>
<a <a
target="_blank" target="_blank"
href="https://pbs.twimg.com/media/GEShpIXXAAAKQ_1?format=jpg" href="https://pbs.twimg.com/media/GEShpIXXAAAKQ_1?format=jpg"