replaced mocked community-tags and images with real data
Co-authored-by: jo-mut <jo_ngei@Johns-MacBook-Air.local>
This commit is contained in:
parent
8454ce2e11
commit
7a9018ae11
|
@ -5,8 +5,8 @@
|
||||||
[react-native.core :as rn]))
|
[react-native.core :as rn]))
|
||||||
|
|
||||||
(defn community-card-view-item
|
(defn community-card-view-item
|
||||||
[{:keys [name description locked images
|
[{:keys [name description locked images cover
|
||||||
status tokens cover tags width]} on-press]
|
status tokens tags width]} on-press]
|
||||||
[rn/touchable-without-feedback
|
[rn/touchable-without-feedback
|
||||||
{:accessibility-label :community-card-item
|
{:accessibility-label :community-card-item
|
||||||
:on-press on-press}
|
:on-press on-press}
|
||||||
|
@ -18,16 +18,16 @@
|
||||||
:on-press on-press}
|
:on-press on-press}
|
||||||
[rn/view
|
[rn/view
|
||||||
{:flex 1}
|
{:flex 1}
|
||||||
[rn/view (style/community-cover-container 40)
|
[rn/view (style/community-cover-container 60)
|
||||||
[rn/image
|
[rn/image
|
||||||
{:source cover
|
{:source cover
|
||||||
:style
|
:style
|
||||||
{:flex 1
|
{:flex 1
|
||||||
:border-radius 20}}]]
|
:border-top-right-radius 20
|
||||||
|
:border-top-left-radius 20}}]]
|
||||||
[rn/view (style/card-view-content-container 12)
|
[rn/view (style/card-view-content-container 12)
|
||||||
[rn/view (style/card-view-chat-icon 48)
|
[rn/view (style/card-view-chat-icon 48)
|
||||||
[icon/community-icon {:images images} 48]]
|
[icon/community-icon {:images images} 48]]
|
||||||
|
|
||||||
(when (= status :gated)
|
(when (= status :gated)
|
||||||
[rn/view (style/permission-tag-styles)
|
[rn/view (style/permission-tag-styles)
|
||||||
[community-view/permission-tag-container
|
[community-view/permission-tag-container
|
||||||
|
|
|
@ -42,16 +42,15 @@
|
||||||
(defn community-tags
|
(defn community-tags
|
||||||
[tags]
|
[tags]
|
||||||
[rn/view (style/community-tags-container)
|
[rn/view (style/community-tags-container)
|
||||||
(for [{:keys [id tag-label resource]} tags]
|
(for [{:keys [name emoji]} tags]
|
||||||
^{:key id}
|
^{:key name}
|
||||||
[rn/view {:margin-right 8}
|
[rn/view {:margin-right 8}
|
||||||
[tag/tag
|
[tag/tag
|
||||||
{:id id
|
{:size 24
|
||||||
:size 24
|
:label name
|
||||||
:label tag-label
|
|
||||||
:type :emoji
|
:type :emoji
|
||||||
:labelled? true
|
:labelled? true
|
||||||
:resource resource}]])])
|
:resource emoji}]])])
|
||||||
|
|
||||||
(defn community-title
|
(defn community-title
|
||||||
[{:keys [title description size] :or {size :small}}]
|
[{:keys [title description size] :or {size :small}}]
|
||||||
|
@ -82,6 +81,5 @@
|
||||||
colors/neutral-80)
|
colors/neutral-80)
|
||||||
:locked? locked?
|
:locked? locked?
|
||||||
:tokens tokens
|
:tokens tokens
|
||||||
|
|
||||||
:size 24
|
:size 24
|
||||||
:on-press on-press}])
|
:on-press on-press}])
|
||||||
|
|
|
@ -57,14 +57,18 @@
|
||||||
|
|
||||||
(defn card-view-content-container
|
(defn card-view-content-container
|
||||||
[padding-horizontal]
|
[padding-horizontal]
|
||||||
{:flex 1
|
{:position :absolute
|
||||||
:height 20
|
:top 40
|
||||||
:padding-left padding-horizontal
|
:bottom 0
|
||||||
:padding-right padding-horizontal
|
:left 0
|
||||||
:border-radius 16
|
:right 0
|
||||||
:background-color (colors/theme-colors
|
:height 20
|
||||||
colors/white
|
:padding-horizontal padding-horizontal
|
||||||
colors/neutral-90)})
|
:border-top-right-radius 16
|
||||||
|
:border-top-left-radius 16
|
||||||
|
:background-color (colors/theme-colors
|
||||||
|
colors/white
|
||||||
|
colors/neutral-90)})
|
||||||
|
|
||||||
(defn card-view-chat-icon
|
(defn card-view-chat-icon
|
||||||
[icon-size]
|
[icon-size]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
(:require [react-native.core :as rn]))
|
(:require [react-native.core :as rn]))
|
||||||
|
|
||||||
(defn style-container
|
(defn style-container
|
||||||
[size disabled border-color border-width background-color label type]
|
[size disabled border-color border-width background-color labelled? type]
|
||||||
(merge {:height size
|
(merge {:height size
|
||||||
:border-color border-color
|
:border-color border-color
|
||||||
:background-color background-color
|
:background-color background-color
|
||||||
|
@ -12,14 +12,23 @@
|
||||||
:justify-content :center}
|
:justify-content :center}
|
||||||
(when disabled
|
(when disabled
|
||||||
{:opacity 0.3})
|
{:opacity 0.3})
|
||||||
(when (and (or (= type :icon) (= type :emoji)) (not label))
|
(when (and (or (= type :icon) (= type :emoji)) (not labelled?))
|
||||||
{:width size})))
|
{:width size})))
|
||||||
|
|
||||||
(defn base-tag
|
(defn base-tag
|
||||||
[_]
|
[_]
|
||||||
(fn [{:keys [id size disabled? border-color border-width background-color on-press
|
(fn
|
||||||
accessibility-label labelled? type]
|
[{:keys [id
|
||||||
:or {size 32}} children]
|
size
|
||||||
|
disabled?
|
||||||
|
border-color
|
||||||
|
border-width
|
||||||
|
background-color
|
||||||
|
on-press
|
||||||
|
accessibility-label
|
||||||
|
type
|
||||||
|
labelled?]
|
||||||
|
:or {size 32}} children]
|
||||||
[rn/touchable-without-feedback
|
[rn/touchable-without-feedback
|
||||||
(merge {:disabled disabled?
|
(merge {:disabled disabled?
|
||||||
:accessibility-label accessibility-label}
|
:accessibility-label accessibility-label}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
:text-color {:style {:color colors/white}}}}})
|
:text-color {:style {:color colors/white}}}}})
|
||||||
|
|
||||||
(defn tag-resources
|
(defn tag-resources
|
||||||
[size type resource icon-color label text-color labelled]
|
[size type resource icon-color label text-color labelled?]
|
||||||
[rn/view
|
[rn/view
|
||||||
{:style (merge {:flex-direction :row
|
{:style (merge {:flex-direction :row
|
||||||
:align-items :center
|
:align-items :center
|
||||||
|
@ -46,16 +46,14 @@
|
||||||
24 12)
|
24 12)
|
||||||
:color icon-color}])
|
:color icon-color}])
|
||||||
(when (= type :emoji)
|
(when (= type :emoji)
|
||||||
[rn/image
|
[text/text
|
||||||
{:source resource
|
{:style {:margin-right 4}
|
||||||
:style (merge (case size
|
:size (case size
|
||||||
32 {:height 20
|
32 :paragraph-1
|
||||||
:width 20}
|
24 :paragraph-2
|
||||||
24 {:height 12
|
nil)}
|
||||||
:width 12})
|
resource])
|
||||||
(when label
|
(when labelled?
|
||||||
{:margin-right 4}))}])
|
|
||||||
(when labelled
|
|
||||||
[text/text
|
[text/text
|
||||||
(merge {:size (case size
|
(merge {:size (case size
|
||||||
32 :paragraph-1
|
32 :paragraph-1
|
||||||
|
@ -70,6 +68,7 @@
|
||||||
(defn tag
|
(defn tag
|
||||||
"opts
|
"opts
|
||||||
{:type :icon/:emoji/:label
|
{:type :icon/:emoji/:label
|
||||||
|
:label string
|
||||||
:size 32/24
|
:size 32/24
|
||||||
:on-press fn
|
:on-press fn
|
||||||
:blurred? true/false
|
:blurred? true/false
|
||||||
|
@ -82,9 +81,21 @@
|
||||||
- `type` can be icon or emoji with or without a tag label
|
- `type` can be icon or emoji with or without a tag label
|
||||||
- `labelled` boolean: is true if tag has label else false"
|
- `labelled` boolean: is true if tag has label else false"
|
||||||
[_ _]
|
[_ _]
|
||||||
(fn [{:keys [id on-press disabled? size resource active accessibility-label
|
(fn
|
||||||
label type labelled? blurred? icon-color override-theme]
|
[{:keys [id
|
||||||
:or {size 32}}]
|
on-press
|
||||||
|
disabled?
|
||||||
|
size
|
||||||
|
active
|
||||||
|
accessibility-label
|
||||||
|
label
|
||||||
|
resource
|
||||||
|
type
|
||||||
|
labelled?
|
||||||
|
blurred?
|
||||||
|
icon-color
|
||||||
|
override-theme]
|
||||||
|
:or {size 32}}]
|
||||||
(let [state (cond disabled? :disabled
|
(let [state (cond disabled? :disabled
|
||||||
active :active
|
active :active
|
||||||
:else :default)
|
:else :default)
|
||||||
|
|
|
@ -138,7 +138,9 @@
|
||||||
:blurred? blurred?
|
:blurred? blurred?
|
||||||
:icon-color icon-color
|
:icon-color icon-color
|
||||||
:disabled? disabled?
|
:disabled? disabled?
|
||||||
:label label
|
:label (if labelled?
|
||||||
|
label
|
||||||
|
(when (= type :label) label))
|
||||||
:type type
|
:type type
|
||||||
:labelled? labelled?
|
:labelled? labelled?
|
||||||
:on-press (fn [id]
|
:on-press (fn [id]
|
||||||
|
@ -150,17 +152,18 @@
|
||||||
:index index
|
:index index
|
||||||
:viewPosition 0.5}))
|
:viewPosition 0.5}))
|
||||||
(when on-change
|
(when on-change
|
||||||
(on-change id)))}
|
(on-change id)))}]])})])
|
||||||
label]])})])
|
|
||||||
[rn/view {:style {:flex-direction :row}}
|
[rn/view {:style {:flex-direction :row}}
|
||||||
(for [{:keys [label id resource]} data]
|
(for [{:keys [id label resource]} data]
|
||||||
^{:key id}
|
^{:key id}
|
||||||
[rn/view {:style {:margin-right 8}}
|
[rn/view {:style {:margin-right 8}}
|
||||||
[tag/tag
|
[tag/tag
|
||||||
(merge {:id id
|
(merge {:id id
|
||||||
:size size
|
:size size
|
||||||
:type type
|
:type type
|
||||||
:label (if labelled? label (when (= type :label) label))
|
:label (if labelled?
|
||||||
|
label
|
||||||
|
(when (= type :label) label))
|
||||||
:active (= id active-tab-id)
|
:active (= id active-tab-id)
|
||||||
:disabled? disabled?
|
:disabled? disabled?
|
||||||
:blurred? blurred?
|
:blurred? blurred?
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
height
|
height
|
||||||
name
|
name
|
||||||
page-nav
|
page-nav
|
||||||
cover
|
logo
|
||||||
sticky-header
|
sticky-header
|
||||||
top-nav
|
top-nav
|
||||||
title-colum
|
title-colum
|
||||||
|
@ -65,11 +65,11 @@
|
||||||
:top 0
|
:top 0
|
||||||
:left 0
|
:left 0
|
||||||
:right 0}}
|
:right 0}}
|
||||||
(when cover
|
(when logo
|
||||||
[reanimated/view
|
[reanimated/view
|
||||||
{:style (style/sticky-header-title opacity-animation)}
|
{:style (style/sticky-header-title opacity-animation)}
|
||||||
[rn/image
|
[rn/image
|
||||||
{:source cover
|
{:source logo
|
||||||
:style style/sticky-header-image}]
|
:style style/sticky-header-image}]
|
||||||
[quo/text
|
[quo/text
|
||||||
{:size :paragraph-1
|
{:size :paragraph-1
|
||||||
|
@ -122,6 +122,7 @@
|
||||||
(let [scroll-height (reagent/atom negative-scroll-position-0)]
|
(let [scroll-height (reagent/atom negative-scroll-position-0)]
|
||||||
(fn
|
(fn
|
||||||
[{:keys [cover-image
|
[{:keys [cover-image
|
||||||
|
logo
|
||||||
page-nav-right-section-buttons
|
page-nav-right-section-buttons
|
||||||
name
|
name
|
||||||
on-scroll
|
on-scroll
|
||||||
|
@ -134,7 +135,7 @@
|
||||||
children]
|
children]
|
||||||
[:<>
|
[:<>
|
||||||
[:f> scroll-page-header @scroll-height height name page-nav-right-section-buttons
|
[:f> scroll-page-header @scroll-height height name page-nav-right-section-buttons
|
||||||
cover-image sticky-header top-nav title-colum navigate-back?]
|
logo sticky-header top-nav title-colum navigate-back?]
|
||||||
[rn/scroll-view
|
[rn/scroll-view
|
||||||
{:content-container-style (style/scroll-view-container
|
{:content-container-style (style/scroll-view-container
|
||||||
(diff-with-max-min @scroll-height 16 0))
|
(diff-with-max-min @scroll-height 16 0))
|
||||||
|
@ -162,5 +163,5 @@
|
||||||
:border-radius (diff-with-max-min @scroll-height 16 0)
|
:border-radius (diff-with-max-min @scroll-height 16 0)
|
||||||
:background-color background-color}
|
:background-color background-color}
|
||||||
(when cover-image
|
(when cover-image
|
||||||
[:f> display-picture @scroll-height cover-image])
|
[:f> display-picture @scroll-height logo])
|
||||||
children])]])))
|
children])]])))
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
(:require [react-native.platform :as platform]))
|
(:require [react-native.platform :as platform]))
|
||||||
|
|
||||||
(def screen-title-container
|
(def screen-title-container
|
||||||
{:height 56
|
{:height 56
|
||||||
:padding-vertical 12
|
:padding-vertical 12
|
||||||
:justify-content :center})
|
:justify-content :center
|
||||||
|
:margin-horizontal 20})
|
||||||
|
|
||||||
(def featured-communities-header
|
(def featured-communities-header
|
||||||
{:flex-direction :row
|
{:flex-direction :row
|
||||||
|
@ -12,6 +13,7 @@
|
||||||
:padding-top 8
|
:padding-top 8
|
||||||
:margin-bottom 8
|
:margin-bottom 8
|
||||||
:padding-right 20
|
:padding-right 20
|
||||||
|
:margin-left 20
|
||||||
:justify-content :space-between})
|
:justify-content :space-between})
|
||||||
|
|
||||||
(def featured-communities-title-container
|
(def featured-communities-title-container
|
||||||
|
@ -21,7 +23,13 @@
|
||||||
(def featured-list-container
|
(def featured-list-container
|
||||||
{:flex-direction :row
|
{:flex-direction :row
|
||||||
:overflow :hidden
|
:overflow :hidden
|
||||||
:margin-bottom 24})
|
:margin-bottom 24
|
||||||
|
:margin-left 20
|
||||||
|
:padding-right 20})
|
||||||
|
|
||||||
|
(def other-communities-container
|
||||||
|
{:flex 1
|
||||||
|
:margin-horizontal 20})
|
||||||
|
|
||||||
(defn discover-communities-segments
|
(defn discover-communities-segments
|
||||||
[fixed?]
|
[fixed?]
|
||||||
|
@ -30,8 +38,9 @@
|
||||||
:height 56
|
:height 56
|
||||||
:background-color :transparent}
|
:background-color :transparent}
|
||||||
(when-not fixed?
|
(when-not fixed?
|
||||||
{:margin-top 12
|
{:margin-top 12
|
||||||
:margin-bottom 4})))
|
:margin-horizontal 20
|
||||||
|
:margin-bottom 4})))
|
||||||
|
|
||||||
(defn discover-screen-container
|
(defn discover-screen-container
|
||||||
[background-color]
|
[background-color]
|
||||||
|
@ -47,8 +56,7 @@
|
||||||
:justify-content :center})
|
:justify-content :center})
|
||||||
|
|
||||||
(def render-communities-container
|
(def render-communities-container
|
||||||
{:padding-horizontal 20
|
{:margin-top 100})
|
||||||
:margin-top 100})
|
|
||||||
|
|
||||||
(defn blur-tabs-header
|
(defn blur-tabs-header
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -18,26 +18,17 @@
|
||||||
{:data {:community-color "#0052FF"
|
{:data {:community-color "#0052FF"
|
||||||
:status :gated
|
:status :gated
|
||||||
:locked? true
|
:locked? true
|
||||||
:cover (resources/get-mock-image :community-cover)
|
|
||||||
:tokens [{:id 1
|
:tokens [{:id 1
|
||||||
:group [{:id 1
|
:group [{:id 1
|
||||||
:token-icon (resources/get-mock-image :status-logo)}]}]
|
:token-icon (resources/get-mock-image :status-logo)}]}]}})
|
||||||
:tags [{:id 1
|
|
||||||
:tag-label (i18n/label :t/music)
|
|
||||||
:resource (resources/get-image :music)}
|
|
||||||
{:id 2
|
|
||||||
:tag-label (i18n/label :t/lifestyle)
|
|
||||||
:resource (resources/get-image :lifestyle)}
|
|
||||||
{:id 3
|
|
||||||
:tag-label (i18n/label :t/podcasts)
|
|
||||||
:resource (resources/get-image :podcasts)}]}})
|
|
||||||
|
|
||||||
(defn render-fn
|
(defn render-fn
|
||||||
[community-item _ _ {:keys [width view-type]}]
|
[community-item _ _ {:keys [width view-type]}]
|
||||||
(let [item (merge community-item
|
(let [item (merge community-item
|
||||||
(get mock-community-item-data :data))]
|
(get mock-community-item-data :data))
|
||||||
|
cover {:uri (get-in (:images item) [:banner :uri])}]
|
||||||
(if (= view-type :card-view)
|
(if (= view-type :card-view)
|
||||||
[quo/community-card-view-item (assoc item :width width)
|
[quo/community-card-view-item (assoc item :width width :cover cover)
|
||||||
#(rf/dispatch [:navigate-to :community-overview (:id item)])]
|
#(rf/dispatch [:navigate-to :community-overview (:id item)])]
|
||||||
[quo/communities-list-view-item
|
[quo/communities-list-view-item
|
||||||
{:on-press (fn []
|
{:on-press (fn []
|
||||||
|
@ -134,7 +125,7 @@
|
||||||
|
|
||||||
(defn other-communities-list
|
(defn other-communities-list
|
||||||
[{:keys [communities communities-ids view-type]}]
|
[{:keys [communities communities-ids view-type]}]
|
||||||
[rn/view {:flex 1}
|
[rn/view {:style style/other-communities-container}
|
||||||
(map-indexed
|
(map-indexed
|
||||||
(fn [inner-index item]
|
(fn [inner-index item]
|
||||||
(let [community-id (when communities-ids item)
|
(let [community-id (when communities-ids item)
|
||||||
|
|
|
@ -288,10 +288,12 @@
|
||||||
(let [categories-heights (reagent/atom [])
|
(let [categories-heights (reagent/atom [])
|
||||||
first-channel-height (reagent/atom 0)
|
first-channel-height (reagent/atom 0)
|
||||||
scroll-height (reagent/atom 0)
|
scroll-height (reagent/atom 0)
|
||||||
cover {:uri (get-in images [:large :uri])}]
|
cover {:uri (get-in images [:banner :uri])}
|
||||||
|
logo {:uri (get-in images [:thumbnail :uri])}]
|
||||||
(fn [community]
|
(fn [community]
|
||||||
[scroll-page/scroll-page
|
[scroll-page/scroll-page
|
||||||
{:cover-image cover
|
{:cover-image cover
|
||||||
|
:logo logo
|
||||||
:page-nav-right-section-buttons (page-nav-right-section-buttons id)
|
:page-nav-right-section-buttons (page-nav-right-section-buttons id)
|
||||||
:name name
|
:name name
|
||||||
:on-scroll #(reset! scroll-height %)
|
:on-scroll #(reset! scroll-height %)
|
||||||
|
|
|
@ -92,9 +92,7 @@
|
||||||
@state
|
@state
|
||||||
{:default-active 1
|
{:default-active 1
|
||||||
:component :tags
|
:component :tags
|
||||||
:labelled? (if (= :label type) true (:labelled? @state))
|
:labelled? (if (= :label (:type @state)) true (:labelled? @state))
|
||||||
:resource (when (= type :icon)
|
|
||||||
:main-icons2/placeholder)
|
|
||||||
:data [{:id 1 :label "Music" :resource (resources/get-image :music)}
|
:data [{:id 1 :label "Music" :resource (resources/get-image :music)}
|
||||||
{:id 2 :label "Lifestyle" :resource (resources/get-image :lifestyle)}
|
{:id 2 :label "Lifestyle" :resource (resources/get-image :lifestyle)}
|
||||||
{:id 2 :label "Podcasts" :resource (resources/get-image :podcasts)}
|
{:id 2 :label "Podcasts" :resource (resources/get-image :podcasts)}
|
||||||
|
|
Loading…
Reference in New Issue