Back
title (clj)
(source)function
(title s)
Output will be: Each Word Capitalized And Separated With Spaces
accepts strings and keywords
Examples
penpot/penpot
(ns app.main.ui.dashboard.files
(:require-macros [app.main.style :as stl])
(:require
[app.main.data.dashboard :as dd]
[app.main.data.events :as ev]
[app.main.refs :as refs]
[app.main.store :as st]
[app.main.ui.dashboard.grid :refer [grid]]
[app.main.ui.dashboard.inline-edition :refer [inline-edition]]
[app.main.ui.dashboard.pin-button :refer [pin-button*]]
[app.main.ui.dashboard.project-menu :refer [project-menu]]
[app.main.ui.hooks :as hooks]
[app.main.ui.icons :as i]
[app.util.dom :as dom]
[app.util.i18n :as i18n :refer [tr]]
[app.util.keyboard :as kbd]
[app.util.router :as rt]
[cuerdas.core :as str]
[rumext.v2 :as mf]))
[:header {:class (stl/css :dashboard-header)}
(if (:is-default project)
[:div#dashboard-drafts-title {:class (stl/css :dashboard-title)}
[:h1 (tr "labels.drafts")]]
(if (:edition @local)
[:& inline-edition
{:content (:name project)
:on-end (fn [name]
(let [name (str/trim name)]
(when-not (str/empty? name)
(st/emit! (-> (dd/rename-project (assoc project :name name))
(with-meta {::ev/origin "project"}))))
(swap! local assoc :edition false)))}]
[:div {:class (stl/css :dashboard-title)}
[:h1 {:on-double-click on-edit
:data-test "project-title"
:id (:id project)}
(:name project)]]))
(mf/with-effect [project]
(when project
(let [pname (if (:is-default project)
(tr "labels.drafts")
(:name project))]
(dom/set-html-title (tr "title.dashboard.files" pname)))))
penpot/penpot
(ns app.main.ui.components.color-bullet
(:require
[app.config :as cfg]
[app.util.color :as uc]
[app.util.dom :as dom]
[app.util.i18n :as i18n :refer [tr]]
[cuerdas.core :as str]
[rumext.v2 :as mf]))
;; No multiple selection
(let [color (if (string? color) {:color color :opacity 1} color)]
[:div.color-bullet
{:class (dom/classnames :is-library-color (some? (:id color))
:is-not-library-color (nil? (:id color))
:is-gradient (some? (:gradient color)))
:on-click on-click
:title (uc/get-color-name color)}
(cond
(:gradient color)
[:div.color-bullet-wrapper {:style {:background (uc/color->background color)}}]
(mf/defc color-name
{::mf/wrap-props false}
[{:keys [color size on-click on-double-click]}]
(let [{:keys [name color gradient image]} (if (string? color) {:color color :opacity 1} color)]
(when (or (not size) (= size :big))
[:span.color-text
{:on-click on-click
:on-double-click on-double-click
:title name}
(if (some? image)
(tr "media.image")
(or name color (uc/gradient-type->string (:type gradient))))])))