Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13939] Implement system message into quo2 components #14061

Merged
merged 13 commits into from
Oct 6, 2022
Prev Previous commit
Next Next commit
Animate background color changes
  • Loading branch information
erikseppanen committed Oct 6, 2022
commit 2dacf84133f64b1bf9b08fe873ce07e9e0f6a23a
32 changes: 21 additions & 11 deletions src/quo2/components/messages/system_message.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[quo.theme :as theme]
[quo2.components.buttons.button :as button]
[quo2.components.markdown.text :as text]
[quo2.reanimated :as ra]
[quo2.foundations.colors :as colors]
[quo2.components.avatars.user-avatar :as user-avatar]
[quo2.components.avatars.icon-avatar :as icon-avatar]))
Expand Down Expand Up @@ -138,14 +139,23 @@
:style {:color (get-color :time)}}
(:info content)])]]]])

(defn system-message
[{:keys [type state] :as message}]
[rn/view {:flex-direction :row
:flex 1
:border-radius 16
:padding-vertical 9
:padding-horizontal 11
:width 359
:height 52
:background-color (get-color :bg state type)}
[sm-render message]])
(defn system-message [{:keys [type] :as message}]
[:f>
(fn []
(let [sv-color (ra/use-shared-value (get-color :bg :landed type))]
(ra/animate-shared-value-with-delay
sv-color (get-color :bg :default type) 0 :linear 1000)
[ra/touchable-opacity
{:on-press #(ra/set-shared-value
sv-color (get-color :bg :pressed type))
:style (ra/apply-animations-to-style
{:background-color sv-color}
{:flex-direction :row
:flex 1
:border-radius 16
:padding-vertical 9
:padding-horizontal 11
:width 359
:height 52
:background-color sv-color})}
[sm-render message]]))])
12 changes: 1 addition & 11 deletions src/quo2/screens/messages/system_message.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@
:key :added}
{:value "Message deleted"
:key :deleted}]}
{:label "Message State"
:key :state
:type :select
:options [{:value "Default"
:key :default}
{:value "Pressed"
:key :pressed}
{:value "Landed"
:key :landed}]}
{:label "Action"
:key :action
:type :select
Expand Down Expand Up @@ -55,8 +46,7 @@
:mentions {:name "Alisher"
:image (resources/get-mock-image :user-picture-male5)}}}))
(defn preview []
(let [state (reagent/atom {:type :pinned
:state :pressed
(let [state (reagent/atom {:type :deleted
:pinned-by "Steve"
:content-text "Hello! This is an example of a pinned message!"
:content-info "3 photos"
Expand Down