Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Information box and implement ens banner view
- Loading branch information
1 parent
a18deec
commit 6100d67
Showing
12 changed files
with
209 additions
and
6 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
(ns quo2.components.info-message | ||
(:require [quo.theme :as theme] | ||
[quo.react-native :as rn] | ||
[quo2.components.text :as text] | ||
[quo2.foundations.colors :as colors] | ||
[quo2.components.icon :as quo2.icons])) | ||
|
||
(def themes | ||
{:light {:default colors/neutral-40 | ||
:success colors/success-50 | ||
:error colors/danger-50} | ||
:dark {:default colors/neutral-60 | ||
:success colors/success-60 | ||
:error colors/danger-60}}) | ||
|
||
(defn get-color [key] | ||
(get-in themes [(theme/get-theme) key])) | ||
|
||
(defn info-message [{:keys [type size icon text-color icon-color icon-margin]} message] | ||
(let [weight (if (= size :default) :regular :medium) | ||
size (if (= size :default) :paragraph-2 :label) | ||
text-color (or text-color (get-color type)) | ||
icon-color (or icon-color text-color) | ||
icon-margin (or icon-margin 4)] | ||
[rn/view {:style {:flex-direction :row | ||
:flex 1}} | ||
[quo2.icons/icon icon {:color icon-color | ||
:size 12 | ||
:container-style {:margin-top 3}}] | ||
[text/text {:size size | ||
:weight weight | ||
:style {:color text-color | ||
:margin-horizontal icon-margin}} message]])) |
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
(ns quo2.components.information-box | ||
(:require [quo.theme :as theme] | ||
[quo.react-native :as rn] | ||
[quo2.foundations.colors :as colors] | ||
[quo2.components.icon :as quo2.icons] | ||
[quo2.components.info-message :as info-message])) | ||
|
||
(def themes | ||
{:light {:default-bg colors/white | ||
:default-border colors/neutral-20 | ||
:default-icon colors/neutral-50 | ||
:default-text colors/black | ||
:informative-bg colors/primary-50-opa-5 | ||
:informative-border colors/primary-50-opa-10 | ||
:informative-icon colors/primary-50 | ||
:informative-text colors/black | ||
:error-bg colors/danger-50-opa-5 | ||
:error-border colors/danger-50-opa-10 | ||
:error-icon colors/danger-50 | ||
:error-text colors/danger-50 | ||
:close-button colors/black} | ||
:dark {:default-bg colors/neutral-90 | ||
:default-border colors/neutral-70 | ||
:default-icon colors/neutral-40 | ||
:default-text colors/white | ||
:informative-bg colors/primary-50-opa-5 | ||
:informative-border colors/primary-50-opa-10 | ||
:informative-icon colors/white | ||
:informative-text colors/white | ||
:error-bg colors/danger-50-opa-5 | ||
:error-border colors/danger-50-opa-10 | ||
:error-icon colors/danger-50 | ||
:error-text colors/danger-50 | ||
:close-button colors/white}}) | ||
|
||
(defn get-color [key] | ||
(get-in themes [(theme/get-theme) key])) | ||
|
||
(defn get-color-by-suffix [type suffix] | ||
(get-color (keyword (str (name type) "-" suffix)))) | ||
|
||
(defn information-box [{:keys [type icon closable? style]} message] | ||
(let [background-color (get-color-by-suffix type "bg") | ||
border-color (get-color-by-suffix type "border") | ||
icon-color (get-color-by-suffix type "icon") | ||
text-color (get-color-by-suffix type "text")] | ||
[rn/view {:style (merge {:background-color background-color | ||
:border-color border-color | ||
:border-width 1 | ||
:border-radius 12 | ||
:padding-vertical 12 | ||
:padding-horizontal 16 | ||
:flex-direction :row} style)} | ||
[info-message/info-message {:size :default | ||
:icon icon | ||
:text-color text-color | ||
:icon-color icon-color | ||
:icon-margin 8} message] | ||
(when closable? | ||
[quo2.icons/icon :main-icons2/close {:size 12 | ||
:color (get-color :close-button) | ||
:container-style {:margin-top 3 | ||
:margin-left 8}}])])) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
(ns quo2.screens.info-message | ||
(:require [quo.react-native :as rn] | ||
[reagent.core :as reagent] | ||
[quo.previews.preview :as preview] | ||
[quo2.foundations.colors :as colors] | ||
[quo2.components.info-message :as quo2])) | ||
|
||
(def descriptor [{:label "Type:" | ||
:key :type | ||
:type :select | ||
:options [{:key :default | ||
:value "Default"} | ||
{:key :success | ||
:value "Success"} | ||
{:key :error | ||
:value "Error"}]} | ||
{:label "Size:" | ||
:key :size | ||
:type :select | ||
:options [{:key :default | ||
:value "Default"} | ||
{:key :tiny | ||
:value "Tiny"}]} | ||
{:label "Message" | ||
:key :message | ||
:type :text}]) | ||
|
||
(defn cool-preview [] | ||
(let [state (reagent/atom {:type :default | ||
:size :default | ||
:icon :main-icons2/placeholder | ||
:message "This is a message"})] | ||
(fn [] | ||
[rn/view {:margin-bottom 50 | ||
:padding 16} | ||
[preview/customizer state descriptor] | ||
[rn/view {:padding-vertical 60 | ||
:align-items :center} | ||
[quo2/info-message @state (:message @state)]]]))) | ||
|
||
(defn preview-info-message [] | ||
[rn/view {:background-color (colors/theme-colors colors/white colors/neutral-90) | ||
:flex 1} | ||
[rn/flat-list {:flex 1 | ||
:keyboardShouldPersistTaps :always | ||
:header [cool-preview] | ||
:key-fn str}]]) |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
(ns quo2.screens.information-box | ||
(:require [quo.react-native :as rn] | ||
[reagent.core :as reagent] | ||
[quo.previews.preview :as preview] | ||
[quo2.foundations.colors :as colors] | ||
[quo2.components.information-box :as quo2])) | ||
|
||
(def descriptor [{:label "Type:" | ||
:key :type | ||
:type :select | ||
:options [{:key :default | ||
:value "Default"} | ||
{:key :informative | ||
:value "Informative"} | ||
{:key :error | ||
:value "Error"}]} | ||
{:label "Closable?:" | ||
:key :closable? | ||
:type :boolean} | ||
{:label "message" | ||
:key :message | ||
:type :text}]) | ||
|
||
(defn cool-preview [] | ||
(let [state (reagent/atom {:type :default | ||
:closable? true | ||
:icon :main-icons2/placeholder | ||
:message "This is an information box This is an information"})] | ||
(fn [] | ||
[rn/view {:margin-bottom 50 | ||
:padding 16} | ||
[preview/customizer state descriptor] | ||
[rn/view {:padding-vertical 60 | ||
:align-items :center} | ||
[quo2/information-box @state (:message @state)]]]))) | ||
|
||
(defn preview-information-box [] | ||
[rn/view {:background-color (colors/theme-colors colors/white colors/neutral-90) | ||
:flex 1} | ||
[rn/flat-list {:flex 1 | ||
:keyboardShouldPersistTaps :always | ||
:header [cool-preview] | ||
:key-fn str}]]) |
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
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