chore: update group-avatar component
This commit is contained in:
parent
da22f4a809
commit
7bc98fcc44
|
@ -1,31 +0,0 @@
|
||||||
(ns quo2.components.avatars.group-avatar.view
|
|
||||||
(:require [quo2.components.icon :as icon]
|
|
||||||
[quo2.theme :as quo.theme]
|
|
||||||
[quo2.foundations.colors :as colors]
|
|
||||||
[react-native.core :as rn]
|
|
||||||
[quo2.components.avatars.group-avatar.style :as style]))
|
|
||||||
|
|
||||||
(def sizes
|
|
||||||
{:icon {:small 12
|
|
||||||
:medium 16
|
|
||||||
:large 20}
|
|
||||||
:container {:small 20
|
|
||||||
:medium 32
|
|
||||||
:large 48}})
|
|
||||||
|
|
||||||
;; TODO: this implementation does not support group display picture (can only display default group
|
|
||||||
;; icon).
|
|
||||||
(defn- view-internal
|
|
||||||
[_]
|
|
||||||
(fn [{:keys [color size theme]}]
|
|
||||||
(let [container-size (get-in sizes [:container size])
|
|
||||||
icon-size (get-in sizes [:icon size])]
|
|
||||||
[rn/view
|
|
||||||
{:style (style/container {:container-size container-size
|
|
||||||
:customization-color color
|
|
||||||
:theme theme})}
|
|
||||||
[icon/icon :i/group
|
|
||||||
{:size icon-size
|
|
||||||
:color colors/white-opa-70}]])))
|
|
||||||
|
|
||||||
(def view (quo.theme/with-theme view-internal))
|
|
|
@ -3,33 +3,36 @@
|
||||||
[quo2.foundations.colors :as colors]
|
[quo2.foundations.colors :as colors]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[reagent.core :as reagent]
|
[reagent.core :as reagent]
|
||||||
|
[status-im2.common.resources :as resources]
|
||||||
[status-im2.contexts.quo-preview.preview :as preview]))
|
[status-im2.contexts.quo-preview.preview :as preview]))
|
||||||
|
|
||||||
(def descriptor
|
(def descriptor
|
||||||
[{:label "Size"
|
[{:label "Size"
|
||||||
:key :size
|
:key :size
|
||||||
:type :select
|
:type :select
|
||||||
:options [{:key :small
|
:options [{:key :x-small
|
||||||
|
:value "x-small"}
|
||||||
|
{:key :small
|
||||||
:value "Small"}
|
:value "Small"}
|
||||||
{:key :medium
|
{:key :medium
|
||||||
:value "Medium"}
|
:value "Medium"}
|
||||||
{:key :large
|
{:key :large
|
||||||
:value "Large"}]}
|
:value "Large"}
|
||||||
{:label "Color"
|
{:key :x-large
|
||||||
:key :color
|
:value "x-Large"}]}
|
||||||
:type :select
|
{:label "Avatar"
|
||||||
:options
|
:key :avatar?
|
||||||
(map
|
:type :boolean}
|
||||||
(fn [c]
|
(preview/customization-color-option)]) ; TODO: this is temporary only. Issue: https://github.com/status-im/status-mobile/issues/14566
|
||||||
{:key c
|
|
||||||
:value c})
|
(def avatar (resources/get-mock-image :user-picture-male4))
|
||||||
["#ff0000" "#0000ff"])}]) ; TODO: this is temporary only. Issue: https://github.com/status-im/status-mobile/issues/14566
|
|
||||||
|
|
||||||
(defn cool-preview
|
(defn cool-preview
|
||||||
[]
|
[]
|
||||||
(let [state (reagent/atom {:theme :light
|
(let [state (reagent/atom {:theme :light
|
||||||
:color :purple
|
:customization-color :blue
|
||||||
:size :small})]
|
:size :small
|
||||||
|
:avatar? false})]
|
||||||
(fn []
|
(fn []
|
||||||
[rn/touchable-without-feedback {:on-press rn/dismiss-keyboard!}
|
[rn/touchable-without-feedback {:on-press rn/dismiss-keyboard!}
|
||||||
[rn/view {:padding-bottom 150}
|
[rn/view {:padding-bottom 150}
|
||||||
|
@ -39,7 +42,12 @@
|
||||||
{:padding-vertical 60
|
{:padding-vertical 60
|
||||||
:flex-direction :row
|
:flex-direction :row
|
||||||
:justify-content :center}
|
:justify-content :center}
|
||||||
[quo2/group-avatar @state]]]])))
|
(let [{:keys [avatar?]} @state
|
||||||
|
params (cond-> @state
|
||||||
|
(boolean avatar?)
|
||||||
|
(assoc :avatar? avatar))]
|
||||||
|
(println params)
|
||||||
|
[quo2/group-avatar params])]]])))
|
||||||
|
|
||||||
(defn preview-group-avatar
|
(defn preview-group-avatar
|
||||||
[]
|
[]
|
||||||
|
|
Loading…
Reference in New Issue