Skip to content

Commit

Permalink
messing with styles
Browse files Browse the repository at this point in the history
  • Loading branch information
bcpeinhardt committed Nov 24, 2024
1 parent 4b9ced2 commit 5232965
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 15 deletions.
11 changes: 10 additions & 1 deletion main.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,17 @@ table {
display: inline;
}

.tg input {
input {
font-family: monospace;
}

input + input {
border-left: none;
border-top: none;
}

input:focus {
outline: none;
}


46 changes: 40 additions & 6 deletions priv/static/squared_away.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8020,6 +8020,14 @@ function view(model) {
})();
let color = $2[0];
let background_color = $2[1];
let border = (() => {
let $13 = isEqual(model.active_cell, new Some(key));
if (!$13) {
return "1px solid gray";
} else {
return "1px solid DeepSkyBlue";
}
})();
let input2 = input(
toList([
on_input2,
Expand All @@ -8034,17 +8042,32 @@ function view(model) {
toList([
["background-color", background_color],
["color", color],
["text-align", alignment]
["text-align", alignment],
["margin", "0px"],
["box-sizing", "border-box"],
["width", "7rem"],
["border", border]
])
)
])
);
let $12 = model.display_coords;
if (!$12) {
return td(toList([]), toList([input2]));
return td(
toList([
style(
toList([["padding", "0px"], ["margin", "0px"]])
)
]),
toList([input2])
);
} else {
return td(
toList([]),
toList([
style(
toList([["padding", "0px"], ["margin", "0px"]])
)
]),
toList([
label(toList([]), t(to_string7(key) + ": ")),
input2
Expand All @@ -8069,7 +8092,18 @@ function view(model) {
});
})();
let grid = table(
toList([class$("tg")]),
toList([
style(
toList([
["height", "70vh"],
["width", "90vw"],
["overflow-y", "auto"],
["overflow-x", "auto"],
["display", "block"],
["border-collapse", "collapse"]
])
)
]),
toList([tbody(toList([]), rows)])
);
let formula_mode_toggle = input(
Expand Down Expand Up @@ -8189,8 +8223,8 @@ function view(model) {
])
);
}
var initial_grid_width = 7;
var initial_grid_height = 20;
var initial_grid_width = 30;
var initial_grid_height = 40;
function init2(_) {
let src_grid = new$4(initial_grid_width, initial_grid_height, "");
let type_checked_grid = new$4(
Expand Down
42 changes: 34 additions & 8 deletions src/squared_away.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import squared_away/squared_away_lang/interpreter/value
import squared_away/squared_away_lang/typechecker/typ
import squared_away/squared_away_lang/typechecker/typed_expr

const initial_grid_width = 7
const initial_grid_width = 30

const initial_grid_height = 20
const initial_grid_height = 40

pub fn main() {
let app = lustre.application(init, update, view)
Expand Down Expand Up @@ -461,6 +461,11 @@ fn view(model: Model) -> element.Element(Msg) {
}
}

let border = case model.active_cell == Some(key) {
False -> "1px solid gray"
True -> "1px solid DeepSkyBlue"
}

let input =
html.input([
on_input,
Expand All @@ -475,16 +480,24 @@ fn view(model: Model) -> element.Element(Msg) {
#("background-color", background_color),
#("color", color),
#("text-align", alignment),
#("margin", "0px"),
#("box-sizing", "border-box"),
#("width", "7rem"),
#("border", border),
]),
])

case model.display_coords {
False -> html.td([], [input])
False ->
html.td(
[attribute.style([#("padding", "0px"), #("margin", "0px")])],
[input],
)
True ->
html.td([], [
html.label([], t(grid.to_string(key) <> ": ")),
input,
])
html.td(
[attribute.style([#("padding", "0px"), #("margin", "0px")])],
[html.label([], t(grid.to_string(key) <> ": ")), input],
)
}
})

Expand All @@ -494,7 +507,20 @@ fn view(model: Model) -> element.Element(Msg) {
|> list.sort(fn(r1, r2) { int.compare(r1.0, r2.0) })
|> list.map(fn(e) { e.1 })

let grid = html.table([attribute.class("tg")], [html.tbody([], rows)])
let grid =
html.table(
[
attribute.style([
#("height", "70vh"),
#("width", "90vw"),
#("overflow-y", "auto"),
#("overflow-x", "auto"),
#("display", "block"),
#("border-collapse", "collapse"),
]),
],
[html.tbody([], rows)],
)

let formula_mode_toggle =
html.input([
Expand Down

0 comments on commit 5232965

Please sign in to comment.