mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 06:06:13 +02:00
✨ Use translations in a DS component story
This commit is contained in:
parent
8aaa04b1f8
commit
8feb5dabb0
4 changed files with 9 additions and 6 deletions
|
@ -91,7 +91,6 @@
|
||||||
:modules
|
:modules
|
||||||
{:base
|
{:base
|
||||||
{:entries []}
|
{:entries []}
|
||||||
|
|
||||||
:components
|
:components
|
||||||
{:exports {default app.main.ui.ds/default}
|
{:exports {default app.main.ui.ds/default}
|
||||||
:depends-on #{:base}}}
|
:depends-on #{:base}}}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
(ns app.main.ui.ds
|
(ns app.main.ui.ds
|
||||||
(:require
|
(:require
|
||||||
|
[app.config :as cf]
|
||||||
[app.main.ui.ds.buttons.button :refer [button*]]
|
[app.main.ui.ds.buttons.button :refer [button*]]
|
||||||
[app.main.ui.ds.buttons.icon-button :refer [icon-button*]]
|
[app.main.ui.ds.buttons.icon-button :refer [icon-button*]]
|
||||||
[app.main.ui.ds.forms.input :refer [input*]]
|
[app.main.ui.ds.forms.input :refer [input*]]
|
||||||
|
@ -17,7 +18,11 @@
|
||||||
[app.main.ui.ds.notifications.toast :refer [toast*]]
|
[app.main.ui.ds.notifications.toast :refer [toast*]]
|
||||||
[app.main.ui.ds.product.loader :refer [loader*]]
|
[app.main.ui.ds.product.loader :refer [loader*]]
|
||||||
[app.main.ui.ds.storybook :as sb]
|
[app.main.ui.ds.storybook :as sb]
|
||||||
[app.main.ui.ds.tab-switcher :refer [tab-switcher*]]))
|
[app.main.ui.ds.tab-switcher :refer [tab-switcher*]]
|
||||||
|
[app.util.i18n :as i18n]))
|
||||||
|
|
||||||
|
|
||||||
|
(i18n/init! cf/translations)
|
||||||
|
|
||||||
(def default
|
(def default
|
||||||
"A export used for storybook"
|
"A export used for storybook"
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
[app.main.style :as stl])
|
[app.main.style :as stl])
|
||||||
(:require
|
(:require
|
||||||
[app.common.math :as mth]
|
[app.common.math :as mth]
|
||||||
|
[app.util.i18n :as i18n :refer [tr]]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
(mf/defc loader-icon*
|
(mf/defc loader-icon*
|
||||||
|
@ -40,11 +41,9 @@
|
||||||
h (or height (when (some? width) (mth/ceil (* width (/ 27 100)))) 27)
|
h (or height (when (some? width) (mth/ceil (* width (/ 27 100)))) 27)
|
||||||
class (dm/str (or class "") " " (stl/css-case :wrapper true
|
class (dm/str (or class "") " " (stl/css-case :wrapper true
|
||||||
:wrapper-overlay overlay))
|
:wrapper-overlay overlay))
|
||||||
|
title (or title (tr "labels.loading"))
|
||||||
props (mf/spread-props props {:class class})]
|
props (mf/spread-props props {:class class})]
|
||||||
|
|
||||||
(assert title
|
|
||||||
(dm/str "You must provide an accesible name for the component"))
|
|
||||||
|
|
||||||
[:> "div" props
|
[:> "div" props
|
||||||
[:> loader-icon* {:title title
|
[:> loader-icon* {:title title
|
||||||
:width w
|
:width w
|
||||||
|
|
|
@ -7,10 +7,10 @@ export default {
|
||||||
title: "Product/Loader",
|
title: "Product/Loader",
|
||||||
component: Loader,
|
component: Loader,
|
||||||
args: {
|
args: {
|
||||||
title: "Loading…",
|
|
||||||
overlay: false,
|
overlay: false,
|
||||||
},
|
},
|
||||||
argTypes: {
|
argTypes: {
|
||||||
|
title: { control: "text" },
|
||||||
width: { control: "number" },
|
width: { control: "number" },
|
||||||
height: { control: "number" },
|
height: { control: "number" },
|
||||||
overlay: { control: "boolean" },
|
overlay: { control: "boolean" },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue