Skip to content

Commit 6fd8f68

Browse files
authored
Merge pull request #3 from wfloat/typing
Add basic homepage
2 parents 93b7641 + 8532099 commit 6fd8f68

File tree

2 files changed

+64
-5
lines changed

2 files changed

+64
-5
lines changed

Diff for: ENUM_EXAMPLES.md

+46-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
```typescript
12
export enum Weekdays {
23
Friday = "Friday",
34
Monday = "Monday",
@@ -7,7 +8,9 @@ export enum Weekdays {
78
Tuesday = "Tuesday",
89
Wednesday = "Wednesday",
910
}
11+
```
1012

13+
```json
1114
{
1215
"type": "object",
1316
"properties": {
@@ -37,15 +40,18 @@ export enum Weekdays {
3740
"weekdays"
3841
]
3942
}
43+
```
4044

4145
------------------------------------------------
4246

43-
47+
```typescript
4448
export enum Enum {
4549
Bar = "bar",
4650
Foo = "foo",
4751
}
52+
```
4853

54+
```json
4955
{
5056
"type": "object",
5157
"additionalProperties": false,
@@ -57,15 +63,17 @@ export enum Enum {
5763
},
5864
"required": ["enum"]
5965
}
60-
66+
```
6167
------------------------------------------------
62-
68+
```typescript
6369
export enum FooEnum {
6470
A = "a",
6571
B = "b",
6672
C = "c",
6773
}
74+
```
6875

76+
```json
6977
{
7078
"type": "object",
7179
"properties": {
@@ -84,18 +92,22 @@ export enum FooEnum {
8492
"foo"
8593
]
8694
}
95+
```
8796

8897
--------------------------------------
8998
ruby
9099

100+
```ruby
91101
module FooEnum
92102
A = "a"
93103
B = "b"
94104
C = "c"
95105
end
106+
```
96107

97108
---------------------------------------
98109

110+
```ruby
99111
module Types
100112
include Dry.Types(default: :nominal)
101113

@@ -113,9 +125,10 @@ module OtherArr
113125
Foo = "foo"
114126
If = "if"
115127
end
128+
```
116129

117130

118-
131+
```ruby
119132
def self.from_json!(json)
120133
from_dynamic!(JSON.parse(json))
121134
end
@@ -144,6 +157,34 @@ module Lvc
144157
Lawful = "lawful"
145158
Neutral = "neutral"
146159
end
147-
160+
```
148161
----------------------------------
162+
```ruby
163+
module Types
164+
include Dry.Types(default: :nominal)
149165

166+
Hash = Strict::Hash
167+
String = Strict::String
168+
Weekdays = Strict::String.enum("Friday", "Monday", "Saturday", "Sunday", "Thursday", "Tuesday", "Wednesday")
169+
end
170+
171+
module Weekdays
172+
Friday = "Friday"
173+
Monday = "Monday"
174+
Saturday = "Saturday"
175+
Sunday = "Sunday"
176+
Thursday = "Thursday"
177+
Tuesday = "Tuesday"
178+
Wednesday = "Wednesday"
179+
end
180+
181+
class TempMulti < Dry::Struct
182+
attribute :weekdays, Types::Weekdays
183+
184+
def self.from_dynamic!(d)
185+
d = Types::Hash[d]
186+
new(
187+
weekdays: d.fetch("weekdays"),
188+
)
189+
end
190+
```
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<.flash_group flash={@flash} />
2+
<div class="root">
3+
<div class="content">
4+
<select name="people">
5+
<option value="name1">Name 1</option>
6+
<option value="name2">Name 2</option>
7+
<!-- Add more options as needed -->
8+
</select>
9+
<textarea rows="4" placeholder="Your message"></textarea>
10+
<button>
11+
Submit
12+
</button>
13+
<audio controls>
14+
<source src="audiofile.mp3" type="audio/mpeg" />
15+
Your browser does not support the audio element.
16+
</audio>
17+
</div>
18+
</div>

0 commit comments

Comments
 (0)