Skip to content

Commit

Permalink
Improved modal box
Browse files Browse the repository at this point in the history
  • Loading branch information
vaijira committed Dec 21, 2024
1 parent cd97940 commit 9e7b322
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 43 deletions.
64 changes: 32 additions & 32 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,35 96,35 @@ jobs:
# command: test
# args: --test interaction -- --ignored --test-threads=1

site:
name: Deploy site
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
steps:
- uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.80.1
override: true
profile: minimal
target: wasm32-unknown-unknown
- uses: jetli/[email protected]
with:
version: 'latest'
- name: Install yarn
run: npm install yarn
- name: Build app
run: yarn run build
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: './dist'
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: ${{ github.event.head_commit.message }}
production-deploy: true
production-branch: main
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 5
# site:
# name: Deploy site
# runs-on: ubuntu-latest
# if: ${{ github.event_name == 'push' }}
# steps:
# - uses: actions/checkout@v2
# - uses: Swatinem/rust-cache@v2
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: 1.80.1
# override: true
# profile: minimal
# target: wasm32-unknown-unknown
# - uses: jetli/[email protected]
# with:
# version: 'latest'
# - name: Install yarn
# run: npm install yarn
# - name: Build app
# run: yarn run build
# - name: Deploy to Netlify
# uses: nwtgck/[email protected]
# with:
# publish-dir: './dist'
# github-token: ${{ secrets.GITHUB_TOKEN }}
# deploy-message: ${{ github.event.head_commit.message }}
# production-deploy: true
# production-branch: main
# env:
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
# NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
# timeout-minutes: 5
28 changes: 19 additions & 9 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 12,11 @@ use wasm_bindgen_futures::spawn_local;
use web_sys::{Element, HtmlAnchorElement, HtmlElement, HtmlInputElement};

use crate::{
css::MODAL_STYLE, data::{Aeat720Information, PersonalInformation}, personal_info::PersonalInfoViewer, table::Table, utils::{file_importer, web}
css::{MODAL_CONTENT_STYLE, MODAL_STYLE},
data::{Aeat720Information, PersonalInformation},
personal_info::PersonalInfoViewer,
table::Table,
utils::{file_importer, web},
};

pub struct App {
Expand Down Expand Up @@ -192,16 196,22 @@ impl App {
})
}

pub fn render(this: Arc<Self>) -> Dom {
fn render_modal_error(this: &Arc<Self>) -> Dom {
html!("div", {
.child(html!("div", {
.class(&*MODAL_STYLE)
.visible_signal(this.modal_visible.signal())
.event(clone!(this => move |_: events::Click| {
this.modal_visible.set_neq(false);
}))
.text_signal(this.current_error.signal_ref(|v| v.clone().unwrap_or("".to_string())))
.class(&*MODAL_STYLE)
.visible_signal(this.modal_visible.signal())
.event(clone!(this => move |_: events::Click| {
this.modal_visible.set_neq(false);
}))
.child(html!("p", {
.class(&*MODAL_CONTENT_STYLE)
.text_signal(this.current_error.signal_ref(|v| v.clone().unwrap_or("".to_string())))
}))
})
}
pub fn render(this: Arc<Self>) -> Dom {
html!("div", {
.child(App::render_modal_error(&this))
.child(html!("h2", {
.text("Paso 1: Rellena datos personales.")
}))
Expand Down
16 changes: 14 additions & 2 deletions src/css.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 11,24 @@ pub static MODAL_STYLE: LazyLock<String> = LazyLock::new(|| {
class! {
.style("position", "fixed")
.style("left", "0")
.style("top", "0")
.style("top", "35%")
.style("width", "100%")
.style("height", "100%")
.style("z-index", "1")
.style("color", "red")
.style("background-color", "gray")
}
});

pub static MODAL_CONTENT_STYLE: LazyLock<String> = LazyLock::new(|| {
class! {
.style("padding", "15px")
.style("background", "#eee")
.style("border-radius", "5px")
.style("display", "inline-block")
.style("vertical-align", "middle")
.style("font-size", "large")
.style("max-width", "400px")
.style("margin", "20px")
}
});

Expand Down

0 comments on commit 9e7b322

Please sign in to comment.