Skip to content

Commit

Permalink
Style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shettysach committed Feb 13, 2024
1 parent a9fb2d6 commit f60a011
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 46 deletions.
1 change: 1 addition & 0 deletions configs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},

"links": {
"github": "shettysach",
"email": "[email protected]",
"linkedin": "in/sachith-shetty-3a165724b",
"twitter": null
Expand Down
2 changes: 1 addition & 1 deletion src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn Base() -> impl IntoView {
let (prompts, set_prompts) = create_signal(1);
let (history, set_history) = create_signal(VecDeque::new());

let prompt_list = move || (0..prompts.get()).collect::<Vec<u32>>();
let prompt_list = move || (0..prompts.get()).collect::<Vec<u8>>();

view! {
<div>
Expand Down
1 change: 0 additions & 1 deletion src/base/banner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pub const HELP: &str = r#"<span class="grn semibold"> ________________ __ ___
/ / / /___/ _, _/ / / / __/ / /_/ / /____/ // /_/ /
/_/ /_____/_/ |_/_/ /_/_/ \____/_____/___/\____/
</span>
Hello, welcome to <u class="blu semibold">Termfolio</u>. Type one of these commands -
<span class="rd semibold">about</span> - View about me
Expand Down
6 changes: 4 additions & 2 deletions src/base/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::collections::VecDeque;

#[component]
pub fn Prompt(
submitter: WriteSignal<u32>,
submitter: WriteSignal<u8>,
updater: WriteSignal<VecDeque<String>>,
history: ReadSignal<VecDeque<String>>,
) -> impl IntoView {
Expand Down Expand Up @@ -87,7 +87,9 @@ pub fn Prompt(
});

submitter.update(|prompts| {
*prompts += 1;
if *prompts < u8::MAX {
*prompts += 1;
}
});
});

Expand Down
17 changes: 9 additions & 8 deletions src/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub struct Education {

#[derive(Deserialize, Serialize, Clone)]
pub struct Links {
pub github: String,
pub email: Option<String>,
pub linkedin: Option<String>,
pub twitter: Option<String>,
Expand All @@ -60,18 +61,18 @@ pub struct Links {
pub struct UserInfo {
pub name: Option<String>,
pub bio: Option<String>,
pub public_repos: u32,
pub public_repos: u16,
pub company: Option<String>,
pub location: Option<String>,
pub followers: u32,
pub following: u32,
pub followers: u16,
pub following: u16,
pub created_at: String,
}

#[derive(Deserialize, Serialize, Clone)]
pub struct UserStats {
pub stars: u32,
pub forks: u32,
pub stars: u16,
pub forks: u16,
}

#[derive(Deserialize, Serialize)]
Expand All @@ -85,8 +86,8 @@ pub struct Repository {
pub repo: String,
pub description: String,
pub language: Language,
pub stars: u32,
pub forks: u32,
pub stars: u16,
pub forks: u16,
}

#[derive(Deserialize, Serialize, Clone)]
Expand Down Expand Up @@ -133,7 +134,7 @@ pub async fn get_repos() -> String {

pub fn get_contacts() -> &'static String {
CONTACTS.get_or_init(|| match read_config() {
Some(config) => format_contacts(config),
Some(config) => format_contacts(&config.links),
_ => String::from(READ_JSON_ERROR),
})
}
Expand Down
54 changes: 27 additions & 27 deletions src/fetch/formats.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::fetch::{About, Config, Repository, UserInfo, UserStats};
use crate::fetch::{About, Links, Repository, UserInfo, UserStats};
use std::collections::HashMap;

const IMG_G: &str = include_str!("../../configs/img_g.txt");
Expand Down Expand Up @@ -195,43 +195,43 @@ pub fn format_repos(username: String, repos: Vec<Repository>) -> String {
format!("{}\n{}", res.join("\n"), all)
}

pub fn format_contacts(config: Config) -> String {
let github = format!(
r#" <a href="https://github.com/{}" target="_blank" style="color:var(--purple);font-weight:500;">Github</a>: github.com/{}"#,
config.github, config.github
pub fn format_contacts(links: &Links) -> String {
let mut result = String::new();

result += &format!(
r#" <a href="https://github.com/{}" target="_blank" class="semibold" style="color:var(--purple);">Github</a>: github.com/{}
"#,
links.github, links.github
);

let email = config.links.email.map(|email| {
format!(
if let Some(email) = &links.email {
result += &format!(
r#"
<a href="mailto:{}" target="_blank" style="color:var(--orange);font-weight:500;">Email</a>: {}"#,
<a href="mailto:{}" target="_blank" class="semibold" style="color:var(--orange);">Email</a>: {}
"#,
email, email
)
});
);
}

let linkedin = config.links.linkedin.map(|linkedin| {
format!(
if let Some(linkedin) = &links.linkedin {
result += &format!(
r#"
<a href="https://www.linkedin.com/{}" target="_blank" style="color:var(--dblue);font-weight:500;">LinkedIn</a>: linkedin.com/{}"#,
<a href="https://www.linkedin.com/{}" target="_blank" class="semibold" style="color:var(--dblue);">LinkedIn</a>: linkedin.com/{}
"#,
linkedin, linkedin
)
});
);
}

let twitter = config.links.twitter.map(|twitter| {
format!(
if let Some(twitter) = &links.twitter {
result += &format!(
r#"
<a href="https://www.twitter.com/{}" target="_blank" style="color:(--blue);font-weight:500;">Twitter/X</a>: @{}"#,
<a href="https://www.twitter.com/{}" target="_blank" class="blu semibold">Twitter/X</a>: @{}
"#,
twitter, twitter
)
});
);
}

format!(
"{}\n{}\n{}\n{}",
github,
email.unwrap_or_default(),
linkedin.unwrap_or_default(),
twitter.unwrap_or_default()
)
result
}

pub fn format_langs(langs: Vec<String>) -> String {
Expand Down
1 change: 0 additions & 1 deletion src/texts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pub const CREDITS: &str = r#"<span class="grn"> _____ ______________ _________
| | | |___| |\ \| | | || | \ \_/ / |_____| |_\ \_/ /
\_/ \____/\_| \_\_| |_/\_| \___/\_____/\___/ \___/
</span>
Terminal style portfolio website, made using Rust.
Made by <span class="rd semibold">Sachith C Shetty</span>
Expand Down
4 changes: 2 additions & 2 deletions styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
--black: #17171e;
--green: #4fd6be;
--red: #c53b53;
--blue: #7dcfff;
--blue: #7aa2f7;
--yellow: #ffc777;
--orange: #ff757f;
--purple: #bb9af7;
--dgreen: #c3e88d;
--dblue: #7aa2f7;
--dblue: #7dcfff;
}

* {
Expand Down
8 changes: 4 additions & 4 deletions styles/themes.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
--black: #181825;
--green: #cba6f7;
--red: #e78284;
--blue: #74c7ec;
--blue: #89b4fa;
--yellow: #f9e2af;
--orange: #fab387;
--purple: #b4befe;
--dgreen: #94e2d5;
--dblue: #89b4fa;
--dblue: #74c7ec;
}

.nord {
Expand All @@ -29,10 +29,10 @@
--black: Black;
--green: LimeGreen;
--red: Crimson;
--blue: DeepSkyBlue;
--blue: DodgerBlue;
--yellow: Gold;
--orange: OrangeRed;
--purple: MediumSlateBlue;
--dgreen: MediumSeaGreen;
--dblue: DodgerBlue;
--dblue: DeepSkyBlue;
}

0 comments on commit f60a011

Please sign in to comment.