forked from tiiuae/ghaf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
labwc: redesign based on Ghaf UI initial prototype
This aligns the system design closer to the prototypes in Figma. Signed-off-by: Humaid Alqasimi <[email protected]>
- Loading branch information
1 parent
1918f93
commit 117bdec
Showing
14 changed files
with
472 additions
and
137 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Copyright 2024 TII (SSRC) and the Ghaf contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
{pkgs, ...}: rec { | ||
/* | ||
* | ||
Resizes a PNG to fit the given size. | ||
# Inputs | ||
`name` | ||
: Name of the file, this will be included in the output filename. | ||
`path` | ||
: Path of the original PNG file to be resized. | ||
`size` | ||
: The new size for the image (<height>x<width>). | ||
# Type | ||
``` | ||
resizePNG :: [String] -> [String] -> [String] -> [String] | ||
``` | ||
# Example | ||
:::{.example} | ||
## Simple example | ||
```nix | ||
resizePNG "my-icon" ./my-icon-hi-res.png "24x24"; | ||
``` | ||
::: | ||
*/ | ||
resizePNG = name: path: size: let | ||
out = | ||
pkgs.runCommand "${name}-${size}" { | ||
nativeBuildInputs = with pkgs; [ | ||
buildPackages.imagemagick | ||
]; | ||
} '' | ||
mkdir -p $out | ||
convert \ | ||
${path} \ | ||
-resize ${size} \ | ||
$out/${name}.png | ||
''; | ||
in "${out}/${name}.png"; | ||
|
||
/* | ||
* | ||
Converts an SVG file to a PNG of a specific size. | ||
# Inputs | ||
`name` | ||
: Name of the file, this will be included in the output filename. | ||
`path` | ||
: Path of the original SVG file to be converted. | ||
`size` | ||
: The size of the PNG image to be rendered. | ||
# Type | ||
``` | ||
svgToPNG :: [String] -> [String] -> [String] -> [String] | ||
``` | ||
# Example | ||
:::{.example} | ||
## Simple example | ||
```nix | ||
svgToPNG "my-icon" ./my-icon.svg "24x24"; | ||
``` | ||
::: | ||
*/ | ||
svgToPNG = name: path: size: let | ||
sizes = builtins.split "x" size; | ||
width = builtins.head sizes; | ||
height = builtins.elemAt sizes 2; | ||
out = | ||
pkgs.runCommand "${name}-${size}" { | ||
nativeBuildInputs = with pkgs; [ | ||
librsvg | ||
]; | ||
} '' | ||
mkdir -p $out | ||
rsvg-convert ${path} -o $out/${name}.png \ | ||
--width=${width} --height=${height} --keep-aspect-ratio | ||
''; | ||
in "${out}/${name}.png"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.