mirror of
https://github.com/penpot/penpot.git
synced 2026-03-13 05:46:08 +00:00
🐛 Fix text component misbehaving when prop is empty string
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
(assert (valid-typography? (dm/str typography))
|
||||
(dm/str typography " is an unknown typography"))
|
||||
|
||||
(let [as (or as "p")
|
||||
(let [as (if (or (empty? as) (nil? as)) "p" as)
|
||||
class (dm/str (or class "") " " (stl/css-case :display-typography (= typography t/display)
|
||||
:title-large-typography (= typography t/title-large)
|
||||
:title-medium-typography (= typography t/title-medium)
|
||||
|
||||
@@ -8,14 +8,6 @@ This component will add a text element to our code that will match the tag prop.
|
||||
|
||||
## Technical notes
|
||||
|
||||
This components accepts to props:
|
||||
|
||||
- `tag` (default value: `p`) : Give a proper tag name (i.e. `p`, `span`, etc.).
|
||||
- `typography` (mandatory): Any of the [supported typography IDs](?path=/docs/foundations-typography--docs).
|
||||
|
||||
You can check passed props to renderized components on hover `tag / typography`
|
||||
|
||||
|
||||
### Using typography IDs
|
||||
|
||||
There are typography ID definitions you can use in your code rather than typing the
|
||||
@@ -35,5 +27,5 @@ Assuming the namespace of the typography is required as `t`:
|
||||
You can now use the typography IDs defined in the namespace:
|
||||
|
||||
```clj
|
||||
[:> text* {:typography t/title-large :tag "p"} "Welcome to Penpot"]
|
||||
[:> text* {:typography t/title-large :as "p"} "Welcome to Penpot"]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user