-
Notifications
You must be signed in to change notification settings - Fork 984
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance the
dapp-avatar
component (#20392)
- Loading branch information
Showing
3 changed files
with
68 additions
and
29 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,23 +1,59 @@ | ||
(ns quo.components.avatars.dapp-avatar.style) | ||
|
||
(def ^:const size 32) | ||
(defn- size->int | ||
[size] | ||
(case size | ||
:size-32 32 | ||
:size-64 64 | ||
32)) | ||
|
||
(def container | ||
{:height size | ||
:width size}) | ||
(defn container | ||
[size] | ||
(let [container-size (size->int size)] | ||
{:height container-size | ||
:width container-size})) | ||
|
||
(def hole-view | ||
{:width size | ||
:height size}) | ||
(defn hole-view | ||
[size] | ||
(let [container-size (size->int size)] | ||
{:width container-size | ||
:height container-size})) | ||
|
||
(def context | ||
{:width 16 | ||
:height 16 | ||
:border-radius 8 | ||
:position :absolute | ||
:right -4 | ||
:bottom -4}) | ||
(defn context | ||
[size] | ||
(let [context-size (case size | ||
:size-32 16 | ||
:size-64 20 | ||
20) | ||
offset (case size | ||
:size-32 -4 | ||
:size-64 0 | ||
-4)] | ||
{:width context-size | ||
:height context-size | ||
:border-radius (/ context-size 2) | ||
:position :absolute | ||
:right offset | ||
:bottom offset})) | ||
|
||
(def image | ||
{:width size | ||
:height size}) | ||
(defn context-hole | ||
[size] | ||
(let [context-hole-size (case size | ||
:size-32 18 | ||
:size-64 24 | ||
18) | ||
offset (case size | ||
:size-32 19 | ||
:size-64 42 | ||
19)] | ||
{:x offset | ||
:y offset | ||
:width context-hole-size | ||
:height context-hole-size | ||
:borderRadius (/ context-hole-size 2)})) | ||
|
||
(defn image | ||
[size] | ||
(let [container-size (size->int size)] | ||
{:width container-size | ||
:height container-size})) |
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