Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 16 additions & 37 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
RUSTC_WRAPPER: "sccache"
RUSTFLAGS: -D warnings
SCCACHE_GHA_ENABLED: "true"
Expand All @@ -17,55 +19,32 @@ jobs:
name: Nightly clippy (wasm32)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

# Install caches
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.6
- name: Cache cargo registry and index
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/index
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo target
uses: actions/cache@v4
- uses: actions/checkout@v6
- uses: mozilla-actions/sccache-action@v0.0.9
- uses: Swatinem/rust-cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}

# Install toolchain
- name: Install toolchain
uses: actions-rs/toolchain@v1
shared-key: "deps-cache-stable"
cache-targets: "false" # IMPORTANT: Let sccache handle target artifacts
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
target: wasm32-unknown-unknown
components: clippy, rustfmt
override: true

# Formatting check
- name: Check formatting
run: cargo fmt -- --check

# Clippy checks
- name: Vertigo-forms Clippy
uses: actions-rs/clippy-check@v1
- name: Clippy (stable)
uses: giraffate/clippy-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -p vertigo-forms --all-features --target wasm32-unknown-unknown -- -Dwarnings
name: Vertigo-forms Clippy Output
- name: Examples Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -p vertigo-forms-storybook -p vertigo-forms-example-manual-form -p vertigo-forms-example-model-form --all-features --target wasm32-unknown-unknown -- -Dwarnings
name: Storybook/Examples Clippy Output
tool_name: "Clippy (stable)"
reporter: github-pr-review
filter_mode: added
github_token: ${{ secrets.GITHUB_TOKEN }}
clippy_flags: --all --all-features --tests --locked

# Unit tests
- name: Unit tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
run: cargo test --all --all-features --locked
9 changes: 7 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<!-- markdownlint-configure-file { "no-duplicate-heading": { "siblings_only": true } } -->

<!-- markdownlint-disable-next-line first-line-h1 -->
## Unreleased
## 0.2.0 - Unreleased

### Added

* `ResourceTable`

### Fixed

* Fixed positioning of `SelectSearch`, `Popup` and `MultiDropDown` popups
* Positioning of `SelectSearch`, `Popup` and `MultiDropDown` popups
* `SelectSearch` sorting

## 0.1.3 - 2026-03-05

Expand Down
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["storybook", "examples/manual_form", "examples/model_form"]

[package]
name = "vertigo-forms"
version = "0.1.3"
version = "0.2.0"
authors = ["Michał Pokrywka <wolfmoon@o2.pl>"]
description = "Building block for forms in vertigo"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion examples/manual_form/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vertigo-forms-example-manual-form"
version = "0.1.3"
version = "0.2.0"
authors = ["Michał Pokrywka <wolfmoon@o2.pl>"]
edition = "2024"

Expand Down
2 changes: 1 addition & 1 deletion examples/model_form/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vertigo-forms-example-model-form"
version = "0.1.3"
version = "0.2.0"
authors = ["Michał Pokrywka <wolfmoon@o2.pl>"]
edition = "2024"

Expand Down
118 changes: 118 additions & 0 deletions src/button.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
use std::rc::Rc;
use vertigo::{component, css, dom};

#[derive(Clone, Copy, PartialEq)]
pub enum ButtonColor {
Primary,
Success,
Danger,
Secondary,
}

#[derive(Clone, Copy, PartialEq)]
pub enum ButtonVariant {
Text,
Outline,
}

#[component]
pub fn Button(
label: String,
on_click: Rc<dyn Fn() + 'static>,
color: ButtonColor,
variant: ButtonVariant,
) {
let style = match (variant, color) {
(ButtonVariant::Text, ButtonColor::Primary) => css!(
"
font-size: 0.8rem; cursor: pointer; font-weight: 600;
color: #007bff;
:hover { text-decoration: underline; }
"
),
(ButtonVariant::Text, ButtonColor::Success) => css!(
"
font-size: 0.8rem; cursor: pointer; font-weight: 600;
color: #28a745;
:hover { text-decoration: underline; }
"
),
(ButtonVariant::Text, ButtonColor::Danger) => css!(
"
font-size: 0.8rem; cursor: pointer; font-weight: 600;
color: #dc3545;
:hover { text-decoration: underline; }
"
),
(ButtonVariant::Text, ButtonColor::Secondary) => css!(
"
font-size: 0.8rem; cursor: pointer; font-weight: 600;
color: #6c757d;
:hover { text-decoration: underline; }
"
),
(ButtonVariant::Outline, ButtonColor::Danger) => css!(
"
font-size: 0.8rem; cursor: pointer; font-weight: 700;
background: #fff; padding: 4px 12px; border-radius: 4px;
border: 1px solid #dc3545; color: #dc3545;
:hover { background: #dc3545; color: #fff; }
"
),
(ButtonVariant::Outline, ButtonColor::Primary) => css!(
"
font-size: 0.8rem; cursor: pointer; font-weight: 700;
background: #fff; padding: 4px 12px; border-radius: 4px;
border: 1px solid #007bff; color: #007bff;
:hover { background: #007bff; color: #fff; }
"
),
(ButtonVariant::Outline, ButtonColor::Success) => css!(
"
font-size: 0.8rem; cursor: pointer; font-weight: 700;
background: #fff; padding: 4px 12px; border-radius: 4px;
border: 1px solid #28a745; color: #28a745;
:hover { background: #28a745; color: #fff; }
"
),
(ButtonVariant::Outline, ButtonColor::Secondary) => css!(
"
font-size: 0.8rem; cursor: pointer; font-weight: 700;
background: #fff; padding: 4px 12px; border-radius: 4px;
border: 1px solid #6c757d; color: #6c757d;
:hover { background: #6c757d; color: #fff; }
"
),
};

dom! {
<div
on_click={move |_| on_click()}
css={style}
>
{label}
</div>
}
}

#[component]
pub fn TableButton(label: String, on_click: Rc<dyn Fn() + 'static>) {
dom! {
<div
on_click={move |_| on_click()}
css={css!{"
padding: 8px 16px;
background: #232323;
color: #fff;
border-radius: 8px;
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
:hover { background: #444; }
"}}
>
{ label }
</div>
}
}
1 change: 1 addition & 0 deletions src/form/data/form_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ pub enum FieldsetStyle {

/// A section of form with label and a field (or field set).
#[derive(Default)]
// #[derive(Clone)]
pub struct DataSection {
pub label: String,
pub fields: Vec<DataField>,
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use std::{collections::HashMap, fmt::Display, str::FromStr};

pub mod button;
mod drop_image_file;
pub mod form;
mod input;
pub mod login;
mod popup;
pub mod resource_table;
mod search_panel;
mod select;
mod select_search;
Expand All @@ -14,6 +16,7 @@ mod tabs;
mod with_loader;

pub use {
button::{Button, ButtonColor, ButtonVariant, TableButton},
drop_image_file::{DropImageFile, DropImageFileParams, image_as_uri, name_to_mime},
input::{Input, InputWithButton, InputWithButtonParams, ListInput},
popup::{Popup, PopupOnHover, PopupParams},
Expand Down
Loading
Loading