-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Malli schemas added to components (#18949)
- Loading branch information
Showing
30 changed files
with
357 additions
and
113 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
(ns quo.components.list-items.account.schema) | ||
|
||
(def ^:private ?balance | ||
[:map | ||
[:balance-props | ||
[:map | ||
[:fiat-value :string] | ||
[:percentage-change :string] | ||
[:fiat-change :string]]]]) | ||
|
||
(def ^:private ?tag | ||
[:map | ||
[:token-props | ||
[:map | ||
[:symbol :string] | ||
[:value :string]]]]) | ||
|
||
(def ^:private ?action | ||
[:map | ||
[:on-options-press {:optional true} [:maybe fn?]]]) | ||
|
||
(def ^:private ?base | ||
[:map | ||
[:type {:optional true} | ||
[:enum :default :tag :action :balance-neutral :balance-negative :balance-positive]] | ||
[:state {:optional true} [:enum :default :selected :active]] | ||
[:blur? {:optional true} [:maybe :boolean]] | ||
[:customization-color {:optional true} [:maybe :schema.common/customization-color]] | ||
[:on-press {:optional true} [:maybe fn?]] | ||
[:theme :schema.common/theme] | ||
[:title-icon {:optional true} [:maybe :keyword]] | ||
[:account-props | ||
[:map | ||
[:name :string] | ||
[:address :string] | ||
[:emoji :string] | ||
[:customization-color {:optional true} [:maybe :schema.common/customization-color]]]]]) | ||
|
||
(def ?schema | ||
[:=> | ||
[:cat | ||
[:multi {:dispatch :type} | ||
[:balance-neutral [:merge ?base ?balance]] | ||
[:balance-negative [:merge ?base ?balance]] | ||
[:balance-positive [:merge ?base ?balance]] | ||
[:tag [:merge ?base ?tag]] | ||
[:action [:merge ?base ?action]] | ||
[:default ?base] | ||
[:malli.core/default ?base]]] | ||
:any]) |
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
30 changes: 30 additions & 0 deletions
30
src/quo/components/list_items/account_list_card/schema.cljs
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,30 @@ | ||
(ns quo.components.list-items.account-list-card.schema) | ||
|
||
(def ^:private ?base | ||
[:map | ||
[:action {:optional true} [:enum :icon :none]] | ||
[:blur? {:optional true} [:maybe :boolean]] | ||
[:on-press {:optional true} [:maybe fn?]] | ||
[:theme :schema.common/theme] | ||
[:account-props | ||
[:map {:closed true} | ||
[:type [:enum :default :watch-only]] | ||
[:name :string] | ||
[:address :string] | ||
[:emoji :string] | ||
[:size {:optional true} [:enum 80 :size-64 48 32 28 24 20 16]] | ||
[:customization-color {:optional true} [:maybe :schema.common/customization-color]]]] | ||
[:networks {:optional true} [:* [:map [:network-name :keyword] [:short-name :string]]]]]) | ||
|
||
(def ^:private ?on-option-press | ||
[:map | ||
[:on-options-press [:maybe fn?]]]) | ||
|
||
(def ?schema | ||
[:=> | ||
[:cat | ||
[:multi {:dispatch :action} | ||
[:icon [:merge ?base ?on-option-press]] | ||
[:none ?base] | ||
[:malli.core/default ?base]]] | ||
:any]) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
(ns quo.components.list-items.address.schema) | ||
|
||
(def ?schema | ||
[:=> | ||
[:cat | ||
[:map | ||
[:address :string] | ||
[:networks {:optional true} [:* [:map [:network-name :keyword] [:short-name :string]]]] | ||
[:customization-color {:optional true} [:maybe :schema.common/customization-color]] | ||
[:on-press {:optional true} [:maybe fn?]] | ||
[:blur? {:optional true} [:maybe :boolean]] | ||
[:theme :schema.common/theme] | ||
[:active-state? {:optional true} [:maybe :boolean]]]] | ||
:any]) |
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
Oops, something went wrong.