Skip to content

Instantly share code, notes, and snippets.

@codesections
Created May 26, 2021 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codesections/b4104bacf6b6474c96ec1d64add0743b to your computer and use it in GitHub Desktop.
Save codesections/b4104bacf6b6474c96ec1d64add0743b to your computer and use it in GitHub Desktop.
épée demo
use Epee;
sub Calculator {
#éffect "document.title = 'Calculator'"; NYI
(div :élan(:width<350px>:height<530px>
:border<solid darkgray>:border-radius<7px>),
(DisplayWindow '0'),
(CalculatorButtons))
}
sub DisplayWindow(Str $text) {
(div :élan(:height<20px>:padding<5px>:font-size<20px>), $text)
}
sub CalculatorButtons {
(div :élan(:width<350px>:height<500px>
:display<grid>:grid-template-rows<repeat(5, 1fr)>),
(Row <AC +/- % ÷>),
(Row <7 8 9 ×>),
(Row <4 5 6 –>),
(Row <1 2 3 +>),
(Row <0 . =>))
}
sub Row(@buttons) {
my $n = 1;
(div :élan(:display<grid>:grid-template-columns<repeat(12, 1fr)>),
@buttons.map: {
(button :élan(:border<solid lightgray>:border-radius<12px>
:margin<0.5px>:font-size<20px>
:grid-column("$n / {$n += (12 / +@buttons)}")),
~$^text )})
}
say Calculator.render;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment