Fix styled input css. Fix css watch mode.
This commit is contained in:
parent
4350ddf7d7
commit
c20cc9ebc5
23
jirs-client/.swcrc
Normal file
23
jirs-client/.swcrc
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"jsc": {
|
||||||
|
"target": "es2018",
|
||||||
|
"parser": {
|
||||||
|
"syntax": "ecmascript",
|
||||||
|
"jsx": false,
|
||||||
|
"dynamicImport": true,
|
||||||
|
"numericSeparator": true,
|
||||||
|
"classPrivateProperty": false,
|
||||||
|
"privateMethod": false,
|
||||||
|
"classProperty": false,
|
||||||
|
"functionBind": false,
|
||||||
|
"exportDefaultFrom": true,
|
||||||
|
"exportNamespaceFrom": true,
|
||||||
|
"decorators": false,
|
||||||
|
"decoratorsBeforeExport": false,
|
||||||
|
"nullishCoalescing": true,
|
||||||
|
"topLevelAwait": true,
|
||||||
|
"importMeta": false,
|
||||||
|
"optionalChaining": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -22,6 +22,11 @@
|
|||||||
padding-left: 32px;
|
padding-left: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.styledInput > .inputElement.primary {
|
||||||
|
padding: 8px 12px 9px;
|
||||||
|
height: 39px;
|
||||||
|
}
|
||||||
|
|
||||||
.styledInput > i.styledIcon {
|
.styledInput > i.styledIcon {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// import "../tmp/styles.css";
|
|
||||||
|
|
||||||
const getWsHostName = () => process.env.JIRS_SERVER_BIND === "0.0.0.0" ? 'localhost' : process.env.JIRS_SERVER_BIND;
|
const getWsHostName = () => process.env.JIRS_SERVER_BIND === "0.0.0.0" ? 'localhost' : process.env.JIRS_SERVER_BIND;
|
||||||
const getProtocol = () => window.location.protocol.replace(/^http/, 'ws');
|
const getProtocol = () => window.location.protocol.replace(/^http/, 'ws');
|
||||||
const wsUrl = () => `${ getProtocol() }//${ getWsHostName() }:${ process.env.JIRS_SERVER_PORT }/ws/`;
|
const wsUrl = () => `${ getProtocol() }//${ getWsHostName() }:${ process.env.JIRS_SERVER_PORT }/ws/`;
|
||||||
|
@ -24,10 +24,13 @@ pub fn update(msg: Msg, model: &mut crate::model::Model, _orders: &mut impl Orde
|
|||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
let _project_page = match &mut model.page_content {
|
let project_page = match &mut model.page_content {
|
||||||
PageContent::Profile(profile_page) => profile_page,
|
PageContent::Profile(profile_page) => profile_page,
|
||||||
_ => return,
|
_ => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
project_page.name.update(&msg);
|
||||||
|
project_page.email.update(&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn view(model: &Model) -> Node<Msg> {
|
pub fn view(model: &Model) -> Node<Msg> {
|
||||||
@ -39,6 +42,7 @@ pub fn view(model: &Model) -> Node<Msg> {
|
|||||||
let username = StyledInput::build(FieldId::Profile(UsersFieldId::Username))
|
let username = StyledInput::build(FieldId::Profile(UsersFieldId::Username))
|
||||||
.state(&page.name)
|
.state(&page.name)
|
||||||
.valid(true)
|
.valid(true)
|
||||||
|
.primary()
|
||||||
.build()
|
.build()
|
||||||
.into_node();
|
.into_node();
|
||||||
let username_field = StyledField::build()
|
let username_field = StyledField::build()
|
||||||
@ -50,6 +54,7 @@ pub fn view(model: &Model) -> Node<Msg> {
|
|||||||
let email = StyledInput::build(FieldId::Profile(UsersFieldId::Username))
|
let email = StyledInput::build(FieldId::Profile(UsersFieldId::Username))
|
||||||
.state(&page.email)
|
.state(&page.email)
|
||||||
.valid(true)
|
.valid(true)
|
||||||
|
.primary()
|
||||||
.build()
|
.build()
|
||||||
.into_node();
|
.into_node();
|
||||||
let email_field = StyledField::build()
|
let email_field = StyledField::build()
|
||||||
|
@ -14,6 +14,7 @@ pub mod styled_checkbox;
|
|||||||
pub mod styled_confirm_modal;
|
pub mod styled_confirm_modal;
|
||||||
pub mod styled_editor;
|
pub mod styled_editor;
|
||||||
pub mod styled_field;
|
pub mod styled_field;
|
||||||
|
pub mod styled_file_input;
|
||||||
pub mod styled_form;
|
pub mod styled_form;
|
||||||
pub mod styled_icon;
|
pub mod styled_icon;
|
||||||
pub mod styled_input;
|
pub mod styled_input;
|
||||||
|
0
jirs-client/src/shared/styled_file_input.rs
Normal file
0
jirs-client/src/shared/styled_file_input.rs
Normal file
@ -4,6 +4,22 @@ use crate::shared::styled_icon::{Icon, StyledIcon};
|
|||||||
use crate::shared::ToNode;
|
use crate::shared::ToNode;
|
||||||
use crate::{FieldId, Msg};
|
use crate::{FieldId, Msg};
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialOrd, PartialEq)]
|
||||||
|
pub enum Variant {
|
||||||
|
Normal,
|
||||||
|
Primary,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ToString for Variant {
|
||||||
|
fn to_string(&self) -> String {
|
||||||
|
match self {
|
||||||
|
Variant::Normal => "normal",
|
||||||
|
Variant::Primary => "primary",
|
||||||
|
}
|
||||||
|
.to_string()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialOrd, PartialEq)]
|
#[derive(Clone, Debug, PartialOrd, PartialEq)]
|
||||||
pub struct StyledInputState {
|
pub struct StyledInputState {
|
||||||
id: FieldId,
|
id: FieldId,
|
||||||
@ -52,6 +68,7 @@ pub struct StyledInput {
|
|||||||
input_type: Option<String>,
|
input_type: Option<String>,
|
||||||
input_class_list: Vec<String>,
|
input_class_list: Vec<String>,
|
||||||
wrapper_class_list: Vec<String>,
|
wrapper_class_list: Vec<String>,
|
||||||
|
variant: Variant,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StyledInput {
|
impl StyledInput {
|
||||||
@ -64,6 +81,7 @@ impl StyledInput {
|
|||||||
input_type: None,
|
input_type: None,
|
||||||
input_class_list: vec![],
|
input_class_list: vec![],
|
||||||
wrapper_class_list: vec![],
|
wrapper_class_list: vec![],
|
||||||
|
variant: Variant::Normal,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,6 +95,7 @@ pub struct StyledInputBuilder {
|
|||||||
input_type: Option<String>,
|
input_type: Option<String>,
|
||||||
input_class_list: Vec<String>,
|
input_class_list: Vec<String>,
|
||||||
wrapper_class_list: Vec<String>,
|
wrapper_class_list: Vec<String>,
|
||||||
|
variant: Variant,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StyledInputBuilder {
|
impl StyledInputBuilder {
|
||||||
@ -118,6 +137,11 @@ impl StyledInputBuilder {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn primary(mut self) -> Self {
|
||||||
|
self.variant = Variant::Primary;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn build(self) -> StyledInput {
|
pub fn build(self) -> StyledInput {
|
||||||
StyledInput {
|
StyledInput {
|
||||||
id: self.id,
|
id: self.id,
|
||||||
@ -127,6 +151,7 @@ impl StyledInputBuilder {
|
|||||||
input_type: self.input_type,
|
input_type: self.input_type,
|
||||||
input_class_list: self.input_class_list,
|
input_class_list: self.input_class_list,
|
||||||
wrapper_class_list: self.wrapper_class_list,
|
wrapper_class_list: self.wrapper_class_list,
|
||||||
|
variant: self.variant,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,15 +171,18 @@ pub fn render(values: StyledInput) -> Node<Msg> {
|
|||||||
input_type,
|
input_type,
|
||||||
mut input_class_list,
|
mut input_class_list,
|
||||||
mut wrapper_class_list,
|
mut wrapper_class_list,
|
||||||
|
variant,
|
||||||
} = values;
|
} = values;
|
||||||
|
|
||||||
wrapper_class_list.push("styledInput".to_string());
|
wrapper_class_list.push("styledInput".to_string());
|
||||||
|
wrapper_class_list.push(variant.to_string());
|
||||||
wrapper_class_list.push(format!("{}", id));
|
wrapper_class_list.push(format!("{}", id));
|
||||||
if !valid {
|
if !valid {
|
||||||
wrapper_class_list.push("invalid".to_string());
|
wrapper_class_list.push("invalid".to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
input_class_list.push("inputElement".to_string());
|
input_class_list.push("inputElement".to_string());
|
||||||
|
input_class_list.push(variant.to_string());
|
||||||
if icon.is_some() {
|
if icon.is_some() {
|
||||||
input_class_list.push("withIcon".to_string());
|
input_class_list.push("withIcon".to_string());
|
||||||
}
|
}
|
||||||
|
@ -3,19 +3,47 @@ const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
|
|||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const dotenv = require('dotenv');
|
const dotenv = require('dotenv');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const { execSync, exec } = require('child_process');
|
const { execSync, spawn } = require('child_process');
|
||||||
|
|
||||||
process.env.RUST_LOG = 'info';
|
process.env.RUST_LOG = 'info';
|
||||||
|
|
||||||
execSync('cd .. && cargo build --bin jirs-css');
|
const jirDir = require('path').join(__dirname, '..').normalize();
|
||||||
|
console.log('jir dir %s', jirDir)
|
||||||
|
|
||||||
if (process.env.NODE_ENV === "production") {
|
if (process.env.NODE_ENV === "production") {
|
||||||
|
execSync('cargo build --bin jirs-css --release', {
|
||||||
|
cwd: jirDir,
|
||||||
|
});
|
||||||
execSync("rm -Rf ./dist");
|
execSync("rm -Rf ./dist");
|
||||||
execSync("mkdir -p ./dist");
|
execSync("mkdir -p ./dist");
|
||||||
execSync('cd .. && ./target/debug/jirs-css -O ./jirs-client/dist/styles.css');
|
execSync('./target/debug/jirs-css -O ./jirs-client/dist/styles.css', {
|
||||||
|
cwd: jirDir,
|
||||||
|
});
|
||||||
console.log("CSS combined");
|
console.log("CSS combined");
|
||||||
} else {
|
} else {
|
||||||
exec('cd .. && ./target/debug/jirs-css --watch -O ./jirs-client/dev/styles.css');
|
execSync('cargo build --bin jirs-css', {
|
||||||
|
cwd: jirDir,
|
||||||
|
});
|
||||||
|
const css = spawn('./target/debug/jirs-css', [
|
||||||
|
'-W',
|
||||||
|
'-O',
|
||||||
|
'./jirs-client/dev/styles.css'
|
||||||
|
], {
|
||||||
|
detached: false,
|
||||||
|
cwd: jirDir,
|
||||||
|
}).on("error", (error) => {
|
||||||
|
console.error(error);
|
||||||
|
process.exit(1);
|
||||||
|
}).on('close', code => {
|
||||||
|
console.error(`CSS watch process finished with code ${ code }`);
|
||||||
|
// process.exit(1);
|
||||||
|
});
|
||||||
|
// css.stdout.on('data', data => {
|
||||||
|
// console.log(`stdout: ${ data }`);
|
||||||
|
// });
|
||||||
|
// css.stderr.on('data', data => {
|
||||||
|
// console.log(`stdout: ${ data }`);
|
||||||
|
// });
|
||||||
console.log("CSS combined, watching for changes...");
|
console.log("CSS combined, watching for changes...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ fn main() -> Result<(), String> {
|
|||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(clap::Arg::with_name("output").short("O").takes_value(true))
|
.arg(clap::Arg::with_name("output").short("O").takes_value(true))
|
||||||
.arg(clap::Arg::with_name("watch").short("W"))
|
.arg(clap::Arg::with_name("watch").short("W").takes_value(false))
|
||||||
.arg(
|
.arg(
|
||||||
clap::Arg::with_name("prelude")
|
clap::Arg::with_name("prelude")
|
||||||
.short("p")
|
.short("p")
|
||||||
@ -297,7 +297,7 @@ fn main() -> Result<(), String> {
|
|||||||
.and_then(|meta| meta.modified())
|
.and_then(|meta| meta.modified())
|
||||||
.unwrap_or_else(|_| SystemTime::UNIX_EPOCH);
|
.unwrap_or_else(|_| SystemTime::UNIX_EPOCH);
|
||||||
|
|
||||||
if app.check_timestamps(root, output_timestamp)? {
|
if app.check_timestamps(root, output_timestamp)? && !matches.is_present("watch") {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user