chore: add transparent outline to notification in top-nav component (#17171)
This commit is contained in:
parent
a8e9b2486b
commit
8036c219e8
|
@ -12,8 +12,7 @@
|
||||||
|
|
||||||
(defn container
|
(defn container
|
||||||
[{:keys [type label container-style customization-color theme value max-value]}]
|
[{:keys [type label container-style customization-color theme value max-value]}]
|
||||||
(let [label-length (count label)
|
(let [width (case (count label)
|
||||||
width (case label-length
|
|
||||||
1 16
|
1 16
|
||||||
2 20
|
2 20
|
||||||
28)]
|
28)]
|
||||||
|
@ -22,8 +21,6 @@
|
||||||
:justify-content :center
|
:justify-content :center
|
||||||
:border-radius 6
|
:border-radius 6
|
||||||
:width width
|
:width width
|
||||||
:margin-vertical 2
|
|
||||||
:margin-horizontal (if (= label-length 1) 2 0)
|
|
||||||
:height 16}
|
:height 16}
|
||||||
container-style)
|
container-style)
|
||||||
(= type :outline)
|
(= type :outline)
|
||||||
|
|
|
@ -44,3 +44,7 @@
|
||||||
{:margin-horizontal 12
|
{:margin-horizontal 12
|
||||||
:color (get-label-color notification theme)
|
:color (get-label-color notification theme)
|
||||||
:flex 1})
|
:flex 1})
|
||||||
|
|
||||||
|
(defn counter
|
||||||
|
[mentions]
|
||||||
|
{:margin-horizontal (if (= (count (str mentions)) 1) 2 0)})
|
||||||
|
|
|
@ -51,7 +51,9 @@
|
||||||
(condp = notification
|
(condp = notification
|
||||||
:mute [quo2.icons/icon :i/muted
|
:mute [quo2.icons/icon :i/muted
|
||||||
{:color (style/mute-notification-icon-color theme)}]
|
{:color (style/mute-notification-icon-color theme)}]
|
||||||
:mention [counter/view {:customization-color customization-color}
|
:mention [counter/view
|
||||||
|
{:customization-color customization-color
|
||||||
|
:container-style (style/counter mentions-count)}
|
||||||
mentions-count]
|
mentions-count]
|
||||||
:notification [quo2.icons/icon :i/notification
|
:notification [quo2.icons/icon :i/notification
|
||||||
{:color (style/mute-notification-icon-color theme)
|
{:color (style/mute-notification-icon-color theme)
|
||||||
|
|
|
@ -4,9 +4,34 @@
|
||||||
[quo2.components.avatars.user-avatar.view :as user-avatar]
|
[quo2.components.avatars.user-avatar.view :as user-avatar]
|
||||||
[quo2.components.counter.counter.view :as counter]
|
[quo2.components.counter.counter.view :as counter]
|
||||||
[quo2.components.navigation.top-nav.style :as style]
|
[quo2.components.navigation.top-nav.style :as style]
|
||||||
|
[react-native.hole-view :as hole-view]
|
||||||
[quo2.theme :as quo.theme]
|
[quo2.theme :as quo.theme]
|
||||||
[quo2.components.common.notification-dot.view :as notification-dot]))
|
[quo2.components.common.notification-dot.view :as notification-dot]))
|
||||||
|
|
||||||
|
(def notification-dot-hole
|
||||||
|
[{:x 37
|
||||||
|
:y -2
|
||||||
|
:width 9
|
||||||
|
:height 9
|
||||||
|
:borderRadius 4}])
|
||||||
|
|
||||||
|
(defn unread-counter-hole
|
||||||
|
[notification-count]
|
||||||
|
(let [x (case (count (str notification-count))
|
||||||
|
(1 2) 33
|
||||||
|
29)
|
||||||
|
width (case (count (str notification-count))
|
||||||
|
1 16
|
||||||
|
2 20
|
||||||
|
28)]
|
||||||
|
(if (pos? (js/Number notification-count))
|
||||||
|
[{:x x
|
||||||
|
:y -5
|
||||||
|
:width width
|
||||||
|
:height 16
|
||||||
|
:borderRadius 6}]
|
||||||
|
[])))
|
||||||
|
|
||||||
(defn- get-button-common-props
|
(defn- get-button-common-props
|
||||||
[{:keys [jump-to? theme blur?]}]
|
[{:keys [jump-to? theme blur?]}]
|
||||||
{:icon-only? true
|
{:icon-only? true
|
||||||
|
@ -47,7 +72,7 @@
|
||||||
:notification-count notification-count
|
:notification-count notification-count
|
||||||
:max-value max-unread-notifications
|
:max-value max-unread-notifications
|
||||||
:customization-color customization-color}]
|
:customization-color customization-color}]
|
||||||
nil))
|
[:<>]))
|
||||||
|
|
||||||
(defn- left-section
|
(defn- left-section
|
||||||
[{:keys [avatar-props on-press customization-color]}]
|
[{:keys [avatar-props on-press customization-color]}]
|
||||||
|
@ -65,6 +90,8 @@
|
||||||
[{:keys [theme
|
[{:keys [theme
|
||||||
jump-to?
|
jump-to?
|
||||||
blur?
|
blur?
|
||||||
|
notification
|
||||||
|
notification-count
|
||||||
activity-center-on-press
|
activity-center-on-press
|
||||||
scan-on-press
|
scan-on-press
|
||||||
qr-code-on-press
|
qr-code-on-press
|
||||||
|
@ -95,12 +122,18 @@
|
||||||
:on-press qr-code-on-press})
|
:on-press qr-code-on-press})
|
||||||
:i/qr-code]
|
:i/qr-code]
|
||||||
[rn/view
|
[rn/view
|
||||||
|
[hole-view/hole-view
|
||||||
|
{:key (hash (str notification notification-count))
|
||||||
|
:holes (case notification
|
||||||
|
(:seen :notification) notification-dot-hole
|
||||||
|
(:mention :mention-seen) (unread-counter-hole notification-count)
|
||||||
|
[])}
|
||||||
[button/button
|
[button/button
|
||||||
(merge button-common-props
|
(merge button-common-props
|
||||||
{:accessibility-label :open-activity-center-button
|
{:accessibility-label :open-activity-center-button
|
||||||
:on-press activity-center-on-press})
|
:on-press activity-center-on-press})
|
||||||
:i/activity-center]]
|
:i/activity-center]]
|
||||||
[notification-highlight props]]))
|
[notification-highlight props]]]))
|
||||||
|
|
||||||
(defn view-internal
|
(defn view-internal
|
||||||
[{:keys [avatar-on-press avatar-props customization-color container-style] :as props}]
|
[{:keys [avatar-on-press avatar-props customization-color container-style] :as props}]
|
||||||
|
|
|
@ -10,12 +10,9 @@
|
||||||
(def descriptor
|
(def descriptor
|
||||||
[{:key :notification
|
[{:key :notification
|
||||||
:type :select
|
:type :select
|
||||||
:options [{:key :mention
|
:options [{:key :mention}
|
||||||
:value "Mention"}
|
{:key :notification}
|
||||||
{:key :notification
|
{:key :seen}]}
|
||||||
:value "Notification"}
|
|
||||||
{:key :seen
|
|
||||||
:value "Seen"}]}
|
|
||||||
{:key :blur?
|
{:key :blur?
|
||||||
:type :boolean}
|
:type :boolean}
|
||||||
{:key :jump-to?
|
{:key :jump-to?
|
||||||
|
|
Loading…
Reference in New Issue