Skip to content

Commit

Permalink
[wip]
Browse files Browse the repository at this point in the history
  • Loading branch information
kimo-k committed Mar 16, 2024
1 parent ff59cc3 commit eb1aef6
Show file tree
Hide file tree
Showing 8 changed files with 639 additions and 467 deletions.
600 changes: 300 additions & 300 deletions src/re_com/dropdown.cljs

Large diffs are not rendered by default.

182 changes: 100 additions & 82 deletions src/re_com/pivot.cljs

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/re_com/theme.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
main (assoc :main main)
user (update :user conj user))))
named->vec
flatten
(remove nil?)
(reduce rf [props ctx])
first)))
flatten
(remove nil?)
(reduce rf [props ctx])
first)))

(defn props [ctx themes]
(apply {} ctx themes))
76 changes: 38 additions & 38 deletions src/re_com/theme/default.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
(defn base [props {:keys [state part transition!]
{:keys [sm-2]} :variables
{:keys [anchor-height]} :component-props
:as ctx}]
:as ctx}]
(->> {}
(case part

Expand All @@ -78,16 +78,16 @@
:open 99999 nil)}}

::dropdown/backdrop
{:class "noselect"
{:class "noselect"
:on-click #(transition! :close)
:style {:position "fixed"
:left "0px"
:top "0px"
:width "100%"
:height "100%"
:pointer-events "none"
:z-index (case (:openable state)
:open 99998 nil)}}
:style {:position "fixed"
:left "0px"
:top "0px"
:width "100%"
:height "100%"
:pointer-events "none"
:z-index (case (:openable state)
:open 99998 nil)}}

::dropdown/body-wrapper
{:style {:position "absolute"
Expand All @@ -100,8 +100,8 @@

(defn main-variables [props _] props)

(defn main [props {:keys [state part]
{:as $
(defn main [props {:keys [state part]
{:as $
:keys [sm-1 sm-3 sm-4 sm-6 md-2 dark shadow light-neutral border]} :variables}]
(->> {}
(case part
Expand All @@ -117,29 +117,29 @@
:box-shadow (str/join " " [sm-4 sm-6 shadow])}}

::dropdown/backdrop
{:style {:color "black"
:opacity (if (-> state :transitionable (= :in)) 0.1 0)
{:style {:color "black"
:opacity (if (-> state :transitionable (= :in)) 0.1 0)
:transition "opacity 0.25s"}}

::dropdown/anchor-wrapper
(let [open? (= :open (:openable state))
closed? (= :closed (:openable state))]
{:style {:background-color (:light $)
:background-clip "padding-box"
:border (str "1px solid "
(cond
closed? "#cccccc"
open? "#66afe9"))
:border-radius sm-3
:box-shadow (cond-> "0 1px 1px rgba(0, 0, 0, .2) inset"
open? (str ", 0 0 8px rgba(82, 168, 236, .6)"))
:color (:neutral $)
:height md-2
:line-height md-2
:padding "0 0 0 8px"
:text-decoration "none"
:white-space "nowrap"
:transition "border 0.2s box-shadow 0.2s"}})
{:style {:background-color (:light $)
:background-clip "padding-box"
:border (str "1px solid "
(cond
closed? "#cccccc"
open? "#66afe9"))
:border-radius sm-3
:box-shadow (cond-> "0 1px 1px rgba(0, 0, 0, .2) inset"
open? (str ", 0 0 8px rgba(82, 168, 236, .6)"))
:color (:neutral $)
:height md-2
:line-height md-2
:padding "0 0 0 8px"
:text-decoration "none"
:white-space "nowrap"
:transition "border 0.2s box-shadow 0.2s"}})

::dropdown/anchor
{:style (cond-> {:color (:foreground $)}
Expand All @@ -159,14 +159,14 @@
:text-overflow "ellipsis"}}

::pivot/row-header-wrapper
{:style {:padding sm-3
:border (str sm-1 " solid " border)
{:style {:padding sm-3
:border (str sm-1 " solid " border)
:background-color light-neutral
:color dark
:text-align "center"
:color dark
:text-align "center"
:font-size sm-6
:font-weight "bold"
:overflow "hidden"
:white-space "nowrap"
:text-overflow "ellipsis"}})
:font-weight "bold"
:overflow "hidden"
:white-space "nowrap"
:text-overflow "ellipsis"}})
(merge-props props)))
2 changes: 1 addition & 1 deletion src/re_com/theme/util.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@

(defn parts [part->props]
(fn [props {:keys [part]}]
(if-let [v (part->props part (part->props (keyword (name part))))]
(if-let [v (get part->props part (part->props (keyword (name part))))]
(merge-props props v)
props)))
4 changes: 2 additions & 2 deletions src/re_demo/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
[re-demo.tag-dropdown :as tag-dropdown]
[re-demo.typeahead :as typeahead]
[re-demo.v-table :as v-table]
[re-demo.simple-v-table :as simple-v-table]
[re-demo.simple-v-table :as simple-v-table]
[re-demo.pivot :as pivot]
[goog.history.EventType :as EventType])
(:import [goog History]))
Expand Down Expand Up @@ -96,7 +96,7 @@
{:id :tables :level :major :label "Tables"}
{:id :simple-v-table :level :minor :label "Simple V-table" :panel simple-v-table/panel}
{:id :v-table :level :minor :label "V-table" :panel v-table/panel}
{:id :pivot :level :minor :label "Pivot Table" :panel pivot/panel}
{:id :pivot :level :minor :label "Pivot Grid" :panel pivot/panel}

{:id :layers :level :major :label "Layers"}
{:id :modal-panel :level :minor :label "Modal Panel" :panel modal-panel/panel}
Expand Down
7 changes: 3 additions & 4 deletions src/re_demo/dropdowns.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
(:require
[re-com.core :refer [at h-box v-box box gap single-dropdown input-text checkbox label title hyperlink-href p p-span line]]
[re-com.dropdown :refer [filter-choices-by-keyword single-dropdown-parts-desc single-dropdown-args-desc dropdown]]
[re-com.util :refer [item-for-id]]
[re-com.util :refer [item-for-id px]]
[re-demo.utils :refer [panel-title title2 title3 parts-table args-table github-hyperlink status-text]]
[re-com.util :refer [px]]
[reagent.core :as reagent]))

(def demos [{:id 1 :label "Simple dropdown"}
Expand Down Expand Up @@ -117,8 +116,8 @@
[]
[h-box :src (at)
:gap "10px"
:children [[dropdown
:body [label :label "body!"]]
:children [#_[dropdown
:body [label :label "body!"]]
[p "The dropdown above is the simple case."]
[p "It presents a list of choices and allows one to be selected, via mouse or keyboard."]]])

Expand Down
Loading

0 comments on commit eb1aef6

Please sign in to comment.