2021-05-16 02:56:54 +03:00
|
|
|
{ utils }:
|
|
|
|
let
|
|
|
|
inherit (utils) mapAttrsToList concatStringsSep isList toString map;
|
|
|
|
|
|
|
|
evalCssValue = value: if isList value then concatStringsSep ", " (map toString value) else toString value;
|
2021-05-17 18:41:37 +03:00
|
|
|
evalInner = inner: concatStringsSep " " (mapAttrsToList (name: value: "${name}: ${evalCssValue value};") inner);
|
2021-05-16 02:56:54 +03:00
|
|
|
css = maybeAttrs:
|
|
|
|
if isList maybeAttrs
|
2021-05-17 18:41:37 +03:00
|
|
|
then concatStringsSep " " maybeAttrs
|
|
|
|
else concatStringsSep " " (mapAttrsToList (name: inner: "${name} { ${evalInner inner} }") maybeAttrs);
|
2021-05-16 02:56:54 +03:00
|
|
|
in
|
|
|
|
{
|
|
|
|
inherit css;
|
|
|
|
|
|
|
|
media = rule: inner: ''
|
2021-05-17 18:41:37 +03:00
|
|
|
@media (${rule}) { ${css inner} }
|
2021-05-16 02:56:54 +03:00
|
|
|
'';
|
|
|
|
}
|