Skip to content

Commit b64e541

Browse files
committed
change export style
1 parent f081ba4 commit b64e541

File tree

2 files changed

+38
-14
lines changed

2 files changed

+38
-14
lines changed

examples/index.html

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,47 @@
1515
margin: 0 auto;
1616
}
1717

18-
pre {
19-
height: 110px;
18+
div {
19+
height: 60px;
2020
background: #eee;
2121
padding: 0.8rem;
2222
margin: 1rem 0;
2323
}
24+
25+
date-time{
26+
display: flex;
27+
justify-content: center;
28+
color: rgb(170, 26, 26);
29+
}
30+
2431
</style>
2532
</head>
2633

2734
<body>
2835
<!-- description -->
29-
<h3>date-time custom element</h3>
30-
<pre>
36+
<h3>&lt;date-time&gt; Custom Element</h3>
37+
<div>
3138
&lt;date-time time-format="hm" date-format="dmy" culture='en-US'&gt;&lt;/date-time&gt;
32-
<date-time time-format="hm" date-format="dmy" culture='en-US'></date-time>
33-
</pre>
34-
<pre>
35-
&lt;date-time time-format="hm12" date-format="dmy" culture='hi-IN'&gt;&lt;/date-time&gt;
36-
<date-time time-format="hm12" date-format="dm" culture='hi-IN'></date-time>
37-
</pre>
38-
<pre>
39+
<date-time class="example-elmnt" time-format="hm" date-format="dmy" culture='en-US'></date-time>
40+
</div>
41+
<div>
42+
&lt;date-time time-format="hm12" date-format="dm" culture='hi-IN'&gt;&lt;/date-time&gt;
43+
<date-time class="example-elmnt" time-format="hm12" date-format="dm" culture='hi-IN'></date-time>
44+
</div>
45+
<div>
46+
&lt;date-time time-format="hm" date-format="dm" culture='fr-FR'&gt;&lt;/date-time&gt;
47+
<date-time class="example-elmnt" time-format="hm" date-format="dm" culture='fr-FR'></date-time>
48+
</div>
49+
<div>
3950
&lt;date-time&gt;&lt;/date-time&gt;
40-
<date-time></date-time>
41-
</pre>
51+
<date-time class="example-elmnt" ></date-time>
52+
</div>
53+
54+
<!-- made with love by Architrixs -->
55+
<p style="text-align: center; font-size: 0.8rem; margin-top: 2rem;">
56+
Made with <span style="color: #e25555;font-size: medium;">&hearts;</span> by
57+
<a href="https://github.com/Architrixs/date-time-custom-element" target="_blank">Architrixs</a>
58+
</p>
4259
<script type="module">
4360
import '../src/date-time.ts'
4461
</script>

src/date-time.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,11 @@ declare global {
129129
}
130130
}
131131
// Define the custom element
132-
customElements.define('date-time', DateTimeElement);
132+
//customElements.define('date-time', DateTimeElement);
133+
134+
export default DateTimeElement
135+
136+
if (!window.customElements.get('date-time')) {
137+
window.DateTimeElement = DateTimeElement
138+
window.customElements.define('date-time', DateTimeElement)
139+
}

0 commit comments

Comments
 (0)