Skip to content

Commit 5221fe0

Browse files
committed
add comp-icon; bump 0.3.2
1 parent a29ce15 commit 5221fe0

File tree

12 files changed

+546
-17
lines changed

12 files changed

+546
-17
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@ Read stylesheets: [style.cljs](https://github.com/Respo/respo-ui/blob/master/src
1313
[![Clojars Project](https://img.shields.io/clojars/v/respo/ui.svg)](https://clojars.org/respo/ui)
1414

1515
```clojure
16-
[respo/ui "0.3.1"]
16+
[respo/ui "0.3.2"]
1717
```
1818

1919
```clojure
2020
[respo-ui.core :as ui]
2121
[respo-ui.colors :as colors]
22-
[respo-ui.comp.switchy :refer [comp-switch]] ; `switch` is a reserved word
22+
```
23+
24+
```clojure
25+
(respo-ui.comp.icon/comp-icon :flash)
26+
(respo-ui.comp.icon/comp-ios-icon :bell)
27+
(respo-ui.comp.icon/comp-android-icon :cart)
2328
```
2429

2530
Use `ui/button` as `:style` attributes for buttons.

build.boot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
:username "jiyinyiyong"
1010
:password (read-password "Clojars password: ")}]))
1111

12-
(def +version+ "0.3.1")
12+
(def +version+ "0.3.2")
1313

1414
(deftask deploy []
1515
(comp

coir.edn

Lines changed: 481 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"license": "MIT",
2626
"devDependencies": {
2727
"http-server": "^0.11.1",
28-
"shadow-cljs": "2.0.134"
28+
"shadow-cljs": "2.0.142"
2929
},
3030
"dependencies": {}
3131
}

shadow-cljs.edn

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

22
{:source-paths ["src"]
33
:dependencies [[mvc-works/hsl "0.1.2"]
4-
[mvc-works/shell-page "0.1.6"]
5-
[mvc-works/verbosely "0.1.2"]
6-
[respo/reel "0.2.3"]
74
[mvc-works/keycode "0.1.3"]
8-
[respo/value "0.2.3"]
5+
[mvc-works/verbosely "0.1.2"]
6+
[mvc-works/shell-page "0.1.6"]
7+
[respo "0.8.13"]
8+
[respo/value "0.2.4"]
99
[respo/router "0.4.0"]
10-
[respo "0.8.12"]]
10+
[respo/reel "0.2.4"]]
1111
:open-file-command ["subl" ["%s:%s:%s" :file :line :column]]
1212
:builds {:browser {:target :browser
1313
:output-dir "target/browser"
@@ -19,7 +19,7 @@
1919
:devtools {:after-load respo-ui.main/reload!
2020
:preloads [shadow.cljs.devtools.client.hud]
2121
:http-root "target"
22-
:http-port 8080}
22+
:http-port 7000}
2323
:release {:output-dir "dist/"
2424
:module-hash-names 8
2525
:build-options {:manifest-name "assets.edn"}}}

src/respo_ui/comp/container.cljs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
[respo-ui.comp.layouts-page :refer [comp-layouts-page]]
1313
[respo-ui.comp.fonts-page :refer [comp-fonts-page]]
1414
[respo-ui.comp.components :refer [comp-components-page]]
15-
[respo-ui.comp.navbar :refer [comp-navbar]]))
15+
[respo-ui.comp.navbar :refer [comp-navbar]]
16+
[respo-ui.comp.icons-page :refer [comp-icons-page]]))
1617

1718
(def style-content {:padding 8})
1819

@@ -40,4 +41,5 @@
4041
"layouts.html" (comp-layouts-page)
4142
"fonts.html" (comp-fonts-page)
4243
"components.html" (cursor-> :components comp-components-page states)
44+
"icons.html" (comp-icons-page)
4345
(<> (pr-str router))))))))

src/respo_ui/comp/icon.cljs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
(ns respo-ui.comp.icon
3+
(:require [respo.macros :refer [defcomp div input textarea button span select option a <>]]
4+
[respo.core :refer [create-element]]))
5+
6+
(defn get-string [icon-name]
7+
(cond
8+
(keyword? icon-name) (name icon-name)
9+
(string? icon-name) icon-name
10+
:else (throw (js/Error. (str "Unknown icon: " (pr-str icon-name))))))
11+
12+
(defcomp
13+
comp-android-icon
14+
(icon-name)
15+
(create-element :i {:class-name (str "ion-android-" (get-string icon-name))}))
16+
17+
(defn comp-icon [icon-name]
18+
(create-element :i {:class-name (str "ion-" (get-string icon-name))}))
19+
20+
(defcomp
21+
comp-ios-icon
22+
(icon-name)
23+
(create-element :i {:class-name (str "ion-ios-" (get-string icon-name))}))

src/respo_ui/comp/icons_page.cljs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
(ns respo-ui.comp.icons-page
3+
(:require [respo.macros :refer [defcomp div <>]]
4+
[respo-ui.core :as ui]
5+
[respo-ui.comp.icon :refer [comp-icon comp-android-icon comp-ios-icon]]))
6+
7+
(defcomp
8+
comp-icons-page
9+
()
10+
(div
11+
{}
12+
(<> "icon pages")
13+
(div {} (comp-icon :flash))
14+
(div {} (comp-ios-icon :bell))
15+
(div {} (comp-android-icon :cart))))

src/respo_ui/comp/sidebar.cljs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@
2828
(render-entry "fonts.html" "Fonts" mobile?)
2929
(render-entry "widgets.html" "Widgets" mobile?)
3030
(render-entry "layouts.html" "Layouts" mobile?)
31-
(render-entry "components.html" "Components" mobile?)))
31+
(render-entry "components.html" "Components" mobile?)
32+
(render-entry "icons.html" "Icons" mobile?)))

src/respo_ui/render.cljs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"/colors.html"
2525
"/layouts.html"
2626
"/fonts.html"
27-
"/components.html"])
27+
"/components.html"
28+
"/icons.html"])
2829

2930
(def preview? (= "preview" js/process.env.prod))
3031

0 commit comments

Comments
 (0)