@robert.tools/atom-text 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.css +1 -1
- package/src/index.njk +16 -8
package/package.json
CHANGED
package/src/index.css
CHANGED
package/src/index.njk
CHANGED
|
@@ -1,23 +1,31 @@
|
|
|
1
|
+
{# defaults #}
|
|
2
|
+
{% set component = "atom.text" %}
|
|
1
3
|
{% set tag = params.tag or "span" %}
|
|
4
|
+
{% set text = (params.prefix or "") ~ params.text ~ (params.suffix or "") %}
|
|
5
|
+
|
|
6
|
+
{# css #}
|
|
2
7
|
{% set css_base = params.css or "text--standard" %}
|
|
3
8
|
{% set css_modifier = params.css_modifier or "" %}
|
|
4
|
-
{% set css = (css_base ~ " " ~ css_modifier) | trim %}
|
|
5
9
|
|
|
6
|
-
{
|
|
10
|
+
{# attributes #}
|
|
11
|
+
{% set id = params.id | addAttribute('id') %}
|
|
12
|
+
{% set css = (css_base ~ " " ~ css_modifier) | trim | addAttribute('class') %}
|
|
13
|
+
{% set atomic = component | addAttribute('data-component') %}
|
|
7
14
|
|
|
8
|
-
{% set
|
|
15
|
+
{% set attrs = id ~ " " ~ css ~ " " ~ atomic %}
|
|
9
16
|
|
|
17
|
+
{# MAIN CONTENT #}
|
|
10
18
|
{% if params.text is defined %}
|
|
11
19
|
{% if tag == 'span' %}
|
|
12
|
-
<span {{
|
|
20
|
+
<span {{attrs | safe }}>{{ text }}</span>
|
|
13
21
|
{% elif tag == 'h1' %}
|
|
14
|
-
<h1 {{
|
|
22
|
+
<h1 {{attrs | safe }}>{{ text }}</h1>
|
|
15
23
|
{% elif tag == 'h2' %}
|
|
16
|
-
<h2 {{
|
|
24
|
+
<h2 {{attrs | safe }}>{{ text }}</h2>
|
|
17
25
|
{% elif tag == 'h3' %}
|
|
18
|
-
<h3 {{
|
|
26
|
+
<h3 {{attrs | safe }}>{{ text }}</h3>
|
|
19
27
|
{% elif tag == 'p' %}
|
|
20
|
-
<p {{
|
|
28
|
+
<p {{attrs | safe }}>{{ text }}</p>
|
|
21
29
|
{% else %}
|
|
22
30
|
{{ text }}
|
|
23
31
|
{% endif %}
|