Packages

Layout and style that's easy to refactor, all without thinking about CSS.

Current section

Files

Jump to
legos src legos@border.erl
Raw

src/legos@border.erl

-module(legos@border).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/legos/border.gleam").
-export([color/1, width/1, width_xy/2, width_each/4, solid/0, dashed/0, dotted/0, rounded/1, rounded_pct/1, round_each/4, shadow/4, inner_shadow/1]).
-file("src/legos/border.gleam", 11).
-spec color(legos@internal@model:color()) -> legos@internal@model:attribute(any(), any()).
color(Clr) ->
{style_class,
legos@internal@flag:border_color(),
{colored,
<<"bc-"/utf8,
(legos@internal@model:format_color_class(Clr))/binary>>,
<<"border-color"/utf8>>,
Clr}}.
-file("src/legos/border.gleam", 22).
-spec width(integer()) -> legos@internal@model:attribute(any(), any()).
width(V) ->
{style_class,
legos@internal@flag:border_width(),
{border_width,
<<"b-"/utf8, (erlang:integer_to_binary(V))/binary>>,
V,
V,
V,
V}}.
-file("src/legos/border.gleam", 29).
-spec width_xy(integer(), integer()) -> legos@internal@model:attribute(any(), any()).
width_xy(X, Y) ->
{style_class,
legos@internal@flag:border_width(),
{border_width,
<<<<<<"bw-"/utf8, (erlang:integer_to_binary(X))/binary>>/binary,
"-"/utf8>>/binary,
(erlang:integer_to_binary(Y))/binary>>,
Y,
X,
Y,
X}}.
-file("src/legos/border.gleam", 42).
-spec width_each(integer(), integer(), integer(), integer()) -> legos@internal@model:attribute(any(), any()).
width_each(Bottom, Left, Right, Top) ->
case (Top =:= Bottom) andalso (Left =:= Right) of
true ->
case Top =:= Right of
true ->
width(Top);
false ->
width_xy(Left, Top)
end;
false ->
{style_class,
legos@internal@flag:border_width(),
{border_width,
<<<<<<<<<<<<<<"bw-"/utf8,
(erlang:integer_to_binary(Top))/binary>>/binary,
"-"/utf8>>/binary,
(erlang:integer_to_binary(Right))/binary>>/binary,
"-"/utf8>>/binary,
(erlang:integer_to_binary(Bottom))/binary>>/binary,
"-"/utf8>>/binary,
(erlang:integer_to_binary(Left))/binary>>,
Top,
Right,
Bottom,
Left}}
end.
-file("src/legos/border.gleam", 75).
-spec solid() -> legos@internal@model:attribute(any(), any()).
solid() ->
{class, legos@internal@flag:border_style(), <<"bs"/utf8>>}.
-file("src/legos/border.gleam", 79).
-spec dashed() -> legos@internal@model:attribute(any(), any()).
dashed() ->
{class, legos@internal@flag:border_style(), <<"bd"/utf8>>}.
-file("src/legos/border.gleam", 83).
-spec dotted() -> legos@internal@model:attribute(any(), any()).
dotted() ->
{class, legos@internal@flag:border_style(), <<"bdt"/utf8>>}.
-file("src/legos/border.gleam", 87).
-spec rounded(integer()) -> legos@internal@model:attribute(any(), any()).
rounded(Radius) ->
{style_class,
legos@internal@flag:border_round(),
{single,
<<"br-"/utf8, (erlang:integer_to_binary(Radius))/binary>>,
<<"border-radius"/utf8>>,
<<(erlang:integer_to_binary(Radius))/binary, "px"/utf8>>}}.
-file("src/legos/border.gleam", 98).
-spec rounded_pct(integer()) -> legos@internal@model:attribute(any(), any()).
rounded_pct(Radius) ->
{style_class,
legos@internal@flag:border_round(),
{single,
<<<<"br-"/utf8, (erlang:integer_to_binary(Radius))/binary>>/binary,
"-pct"/utf8>>,
<<"border-radius"/utf8>>,
<<(erlang:integer_to_binary(Radius))/binary, "%"/utf8>>}}.
-file("src/legos/border.gleam", 109).
-spec round_each(integer(), integer(), integer(), integer()) -> legos@internal@model:attribute(any(), any()).
round_each(Top_left, Top_right, Bottom_left, Bottom_right) ->
{style_class,
legos@internal@flag:border_round(),
{single,
<<<<<<<<<<<<<<"br-"/utf8,
(erlang:integer_to_binary(Top_left))/binary>>/binary,
"-"/utf8>>/binary,
(erlang:integer_to_binary(Top_right))/binary>>/binary,
"-"/utf8>>/binary,
(erlang:integer_to_binary(Bottom_left))/binary>>/binary,
"-"/utf8>>/binary,
(erlang:integer_to_binary(Bottom_right))/binary>>,
<<"border-radius"/utf8>>,
<<<<<<<<<<<<<<(erlang:integer_to_binary(Top_left))/binary,
"px "/utf8>>/binary,
(erlang:integer_to_binary(Top_right))/binary>>/binary,
"px "/utf8>>/binary,
(erlang:integer_to_binary(Bottom_right))/binary>>/binary,
"px "/utf8>>/binary,
(erlang:integer_to_binary(Bottom_left))/binary>>/binary,
"px"/utf8>>}}.
-file("src/legos/border.gleam", 139).
-spec shadow(
legos@internal@model:color(),
{integer(), integer()},
integer(),
integer()
) -> legos@internal@model:attribute(any(), any()).
shadow(Color, Offset, Blur, Size) ->
Shade = {inset_shadow,
Color,
begin
_pipe = Offset,
_pipe@1 = gleam@pair:map_first(_pipe, fun erlang:float/1),
gleam@pair:map_second(_pipe@1, fun erlang:float/1)
end,
erlang:float(Blur),
erlang:float(Size),
false},
{style_class,
legos@internal@flag:shadows(),
{single,
legos@internal@model:box_shadow_class(Shade),
<<"box-shadow"/utf8>>,
legos@internal@model:format_box_shadow(Shade)}}.
-file("src/legos/border.gleam", 166).
-spec inner_shadow(legos@internal@model:shadow()) -> legos@internal@model:attribute(any(), any()).
inner_shadow(Almost_shade) ->
Shade = {inset_shadow,
erlang:element(2, Almost_shade),
begin
_pipe = erlang:element(3, Almost_shade),
_pipe@1 = gleam@pair:map_first(_pipe, fun erlang:float/1),
gleam@pair:map_second(_pipe@1, fun erlang:float/1)
end,
erlang:float(erlang:element(4, Almost_shade)),
erlang:float(erlang:element(5, Almost_shade)),
true},
{style_class,
legos@internal@flag:shadows(),
{single,
legos@internal@model:box_shadow_class(Shade),
<<"box-shadow"/utf8>>,
legos@internal@model:format_box_shadow(Shade)}}.