mirror of https://github.com/logseq/logseq
feat: support disabled button state
parent
ed1dcb9e7e
commit
6ed58e1654
|
@ -950,17 +950,19 @@
|
||||||
(f (merge {:size 18} (r/map-keys->camel-case opts)))])))))))
|
(f (merge {:size 18} (r/map-keys->camel-case opts)))])))))))
|
||||||
|
|
||||||
(defn button
|
(defn button
|
||||||
[text & {:keys [background href class intent on-click small? large? title icon icon-props]
|
[text & {:keys [background href class intent on-click small? large? title icon icon-props disabled?]
|
||||||
:or {small? false large? false}
|
:or {small? false large? false}
|
||||||
:as option}]
|
:as option}]
|
||||||
(let [klass (when-not intent ".bg-indigo-600.hover:bg-indigo-700.focus:border-indigo-700.active:bg-indigo-700.text-center")
|
(let [klass (when-not intent ".bg-indigo-600.hover:bg-indigo-700.focus:border-indigo-700.active:bg-indigo-700.text-center")
|
||||||
klass (if background (string/replace klass "indigo" background) klass)
|
klass (if background (string/replace klass "indigo" background) klass)
|
||||||
klass (if small? (str klass ".px-2.py-1") klass)
|
klass (if small? (str klass ".px-2.py-1") klass)
|
||||||
klass (if large? (str klass ".text-base") klass)]
|
klass (if large? (str klass ".text-base") klass)
|
||||||
|
klass (if disabled? (str klass "disabled:opacity-75") klass)]
|
||||||
[:button.ui__button
|
[:button.ui__button
|
||||||
(merge
|
(merge
|
||||||
{:type "button"
|
{:type "button"
|
||||||
:title title
|
:title title
|
||||||
|
:disabled disabled?
|
||||||
:class (str (util/hiccup->class klass) " " class)}
|
:class (str (util/hiccup->class klass) " " class)}
|
||||||
(dissoc option :background :class :small? :large?)
|
(dissoc option :background :class :small? :large?)
|
||||||
(when href
|
(when href
|
||||||
|
|
Loading…
Reference in New Issue