Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
olegdayo committed Jun 2, 2023
0 parents commit dd379ef
Show file tree
Hide file tree
Showing 16 changed files with 222 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/.workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CD

on:
push:
branches: [master]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown

- name: Install Trunk
uses: jetli/[email protected]
with:
version: 'latest'

- uses: jetli/[email protected]

- name: Build
run: trunk build --release --public-url /me/

- name: Upload Artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./dist

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
40 changes: 40 additions & 0 deletions .github/.workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
push:
branches: ["master", "ci"]
pull_request:
branches: ["master", "ci"]

env:
CARGO_TERM_COLOR: always

jobs:
ci:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown

- name: Install Trunk
uses: jetli/[email protected]
with:
version: 'latest'

- name: Build
run: trunk build

- name: Test
run: cargo test --verbose --verbose

- name: Check Format
run: cargo fmt --all -- --check

- name: Check Warnings
run: cargo clippy -- -D warnings
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# OS
.DS_Store

# Build
dist/
target/

# IDE
.fleet/
.idea/
.vscode/

# Other
Cargo.lock
12 changes: 12 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "me"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
yew = { version = "0.20", features = ["csr"] }
yew-hooks = "0.2"
yew-router = "0.17"
wasm-bindgen = "0.2"
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Source code of my personal page

[ci]: https://github.com/offluck/me/actions/workflows/ci.yaml/badge.svg
[cd]: https://github.com/offluck/me/actions/workflows/cd.yaml/badge.svg

![CI][ci]
![CD][cd]
Binary file added README.pdf
Binary file not shown.
Binary file added assets/images/profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link data-trunk rel="sass" href="index.scss" />
<link data-trunk rel="copy-dir" href="assets" />

<title>Oleg's personal page</title>
</head>

</html>
24 changes: 24 additions & 0 deletions index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
html,
body {
height: 100%;
margin: 0;
}

body {
display: flex;
justify-content: center;

background: linear-gradient(to bottom right, #ffffff, #fff6d5);
font-size: 1.5rem;
}

main {
color: #000000;
font-family: sans-serif;
text-align: center;
}

.profile.profile {
height: 60%;
width: auto;
}
14 changes: 14 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::router::{switch, Route};
use yew::prelude::*;
use yew_router::{HashRouter, Switch};

#[function_component(App)]
pub fn app() -> Html {
html! {
<main>
<HashRouter>
<Switch<Route> render={switch} />
</HashRouter>
</main>
}
}
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub mod app;
pub mod pages;
pub mod router;
5 changes: 5 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use me::app::App;

fn main() {
yew::Renderer::<App>::new().render();
}
13 changes: 13 additions & 0 deletions src/pages/general.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use yew::prelude::*;

#[function_component(General)]
pub fn general() -> Html {
html! {
<>
<div class="profile">
<p> {"Hey there! The name's Oleg"} </p>
<img class="profile" src={ "assets/images/profile.png" } alt="Profile" />
</div>
</>
}
}
2 changes: 2 additions & 0 deletions src/pages/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod general;
pub mod not_found;
10 changes: 10 additions & 0 deletions src/pages/not_found.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use yew::prelude::*;

#[function_component(NotFound)]
pub fn not_found() -> Html {
html! {
<>
<p> {"Page not found"} </p>
</>
}
}
25 changes: 25 additions & 0 deletions src/router.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use crate::pages::{general::General, not_found::NotFound};
use yew::prelude::*;
use yew_router::prelude::*;

#[derive(Debug, Clone, Copy, PartialEq, Routable)]
pub enum Route {
#[at("/")]
General,
#[not_found]
#[at("/not-found")]
NotFound,
}

pub fn switch(route: Route) -> Html {
match route {
Route::General => html! {
<General/>
},
Route::NotFound => html! {
<>
<NotFound/>
</>
},
}
}

0 comments on commit dd379ef

Please sign in to comment.