Skip to content

Commit 187c4fb

Browse files
authored
Add Popover Component (#54)
* fix tooltip accessability * add popover component * Add popover docs * animate in with a keyframe instead of transitions * add css linting * ignore a few lints * sort css
1 parent 315b62e commit 187c4fb

File tree

42 files changed

+1027
-483
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1027
-483
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ target
22

33
**/.claude/settings.local.json
44
node_modules
5+
package-lock.json
56

67
# Playwright
78
/test-results/

preview/.stylelintrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": ["stylelint-config-standard", "stylelint-config-idiomatic-order"],
3+
"rules": {
4+
"number-max-precision": null,
5+
"no-descending-specificity": null
6+
},
7+
"ignoreFiles": ["assets/prism.css", "**/*.js"]
8+
}

preview/assets/hero.css

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
}
99

1010
#hero>h1, #hero>h2 {
11+
margin: 10px 0;
1112
color: var(--text-color);
1213
font-family: Arial, Helvetica, sans-serif;
1314
font-size: 1.5rem;
1415
font-weight: 500;
15-
margin: 10px 0;
1616
}
1717

1818
#hero>h1{
@@ -21,36 +21,34 @@
2121
}
2222

2323
#hero #title {
24-
font-weight: 500;
2524
font-size: 2rem;
25+
font-weight: 500;
2626
}
2727

2828
#hero-separator {
29-
margin-bottom: 50px;
3029
height: 2px;
30+
margin-bottom: 50px;
3131
}
3232

3333
#hero-search-container {
3434
display: flex;
35+
width: 100%;
36+
max-width: 800px;
3537
flex-direction: column;
3638
align-items: center;
3739
justify-content: center;
38-
width: 100%;
39-
max-width: 800px;
4040
margin: auto;
4141
}
4242

4343
#hero-search-input {
4444
width: 100%;
45-
margin: 20px 0;
46-
padding: 10px;
47-
color: var(--text-color);
45+
box-sizing: border-box;
46+
padding: 10px 20px;
4847
border: 1px solid var(--dim-border-color);
4948
border-radius: .5rem;
50-
background-color: var(--brighter-background-color);
51-
box-sizing: border-box;
5249
margin: 2em auto;
53-
padding: 10px 20px;
50+
background-color: var(--brighter-background-color);
51+
color: var(--text-color);
5452
}
5553

5654
#hero-search-input:focus-visible {

preview/assets/main.css

Lines changed: 47 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ html[data-theme="light"] {
2424
}
2525

2626
.navbar {
27+
position: sticky;
28+
z-index: 1000;
29+
top: 0;
2730
display: flex;
2831
align-items: center;
2932
justify-content: space-between;
30-
position: sticky;
3133
padding: 0.5rem 1rem;
32-
top: 0;
33-
z-index: 1000;
34-
background-color: var(--background-color);
3534
border-bottom: 1px solid var(--dim-border-color);
35+
background-color: var(--background-color);
3636
}
3737

3838
.navbar-link {
39+
padding: 0.5em 0;
3940
color: var(--text-color);
40-
text-decoration: none;
4141
font-size: 1.2em;
4242
font-weight: bold;
43-
padding: 0.5em none;
43+
text-decoration: none;
4444
}
4545

4646
.navbar-link:hover {
@@ -54,58 +54,57 @@ html[data-theme="light"] {
5454

5555
.navbar-brand {
5656
display: flex;
57-
text-decoration: none;
5857
align-items: center;
58+
color: var(--text-color);
5959
font-size: 1.5em;
6060
font-weight: bold;
61-
color: var(--text-color);
61+
text-decoration: none;
6262
}
6363

6464
/* Code block styles */
6565
.code-block {
66-
font-family: "Courier New", Courier, monospace;
67-
border-radius: 0.5rem;
6866
overflow: scroll;
6967
width: 100%;
7068
height: 100%;
7169
max-height: 80vh;
7270
box-sizing: border-box;
7371
padding: 0.5rem;
72+
border-radius: 0.5rem;
7473
margin: 0;
74+
font-family: "Courier New", Courier, monospace;
7575
}
7676

7777
.code-block[data-collapsed="true"] {
78+
overflow: hidden;
7879
height: 10em;
7980
backdrop-filter: blur(1px);
8081
mask: linear-gradient(
8182
to bottom,
82-
rgba(0, 0, 0, 1) 0%,
83-
rgba(0, 0, 0, 1) 60%,
84-
rgba(0, 0, 0, 0) 100%
83+
rgb(0 0 0 / 100%) 0%,
84+
rgb(0 0 0 / 100%) 60%,
85+
rgb(0 0 0 / 0%) 100%
8586
);
86-
overflow: hidden;
8787
user-select: none;
88-
-webkit-user-select: none;
8988
}
9089

9190
.dark-mode-toggle {
92-
background: none;
9391
border: none;
94-
cursor: pointer;
92+
background: none;
9593
color: var(--text-color);
94+
cursor: pointer;
9695
}
9796

9897
.copy-button {
99-
display: flex;
100-
align-items: center;
101-
justify-content: center;
10298
position: absolute;
10399
top: 0.5em;
104100
right: 0.5em;
105-
background: none;
106-
color: var(--text-color);
101+
display: flex;
102+
align-items: center;
103+
justify-content: center;
107104
border: none;
108105
border-radius: 0.5rem;
106+
background: none;
107+
color: var(--text-color);
109108
cursor: pointer;
110109
}
111110

@@ -118,73 +117,65 @@ html[data-theme="light"] {
118117
}
119118

120119
/* Demo frame styles */
121-
.component-title {
122-
font-size: 1.5em;
123-
margin: 0.5em 0;
124-
text-transform: capitalize;
125-
}
126-
127120
.component-preview {
128121
display: flex;
122+
width: 100vw;
129123
flex-direction: column;
130124
align-items: center;
131125
justify-content: center;
132-
width: 100vw;
133126
}
134127

135128
.component-preview-contents {
136129
display: flex;
130+
width: 75vw;
137131
flex-direction: column;
138132
align-items: center;
139133
justify-content: center;
140134
margin: 20px 0;
141-
width: 75vw;
142135
}
143136

144137
.component-preview-frame {
145138
display: flex;
146-
flex-direction: column;
147-
align-items: center;
148-
justify-content: center;
149139
width: 100%;
150140
min-height: 25vh;
151141
max-height: 100%;
152-
border-top-right-radius: 0.5em;
153-
border-top-left-radius: 0.5em;
154-
padding: 20px;
155142
box-sizing: border-box;
143+
flex-direction: column;
144+
align-items: center;
145+
justify-content: center;
146+
padding: 20px;
156147
border: 1px solid var(--dim-border-color);
148+
border-radius: 0.5em;
157149
background-color: var(--muted-background-color);
158-
border-radius: 8px;
159150
}
160151

161152
/* component info styles */
162153
.component-title {
163-
font-size: 2em;
164154
width: 100%;
165-
text-align: center;
166-
margin-bottom: 20px;
167155
margin-top: 20px;
156+
margin-bottom: 20px;
157+
font-size: 2em;
158+
text-align: center;
168159
text-transform: capitalize;
169160
}
170161

171162
.component-description {
172-
font-size: 1em;
173163
margin: 5vw;
164+
font-size: 1em;
174165
}
175166

176167
.component-code {
177168
display: flex;
178-
flex-direction: column;
179-
align-items: center;
180-
justify-content: center;
181169
width: 100%;
182170
min-height: 25vh;
183171
max-height: 100%;
184-
border-top-right-radius: 0.5em;
185-
border-top-left-radius: 0.5em;
186-
padding-top: 2rem;
187172
box-sizing: border-box;
173+
flex-direction: column;
174+
align-items: center;
175+
justify-content: center;
176+
padding-top: 2rem;
177+
border-top-left-radius: 0.5em;
178+
border-top-right-radius: 0.5em;
188179
}
189180

190181
/* Masonry styles */
@@ -193,26 +184,27 @@ html[data-theme="light"] {
193184
flex-wrap: wrap;
194185
padding: 0 0 0 1rem;
195186
}
187+
196188
.masonry-with-columns .masonry-preview-frame {
197189
display: flex;
190+
max-width: calc(100vw - 2rem);
191+
min-height: 10rem;
192+
box-sizing: border-box;
193+
flex: 1 0 auto;
198194
flex-direction: column;
199195
align-items: center;
200-
min-height: 10rem;
201-
max-width: calc(100vw - 2rem);
202-
margin: 0 1rem 1rem 0;
203196
padding: 3rem;
204-
flex: 1 0 auto;
205-
border-radius: 0.5rem;
206197
border: 1px solid var(--dim-border-color);
198+
border-radius: 0.5rem;
199+
margin: 0 1rem 1rem 0;
207200
background-color: var(--muted-background-color);
208-
box-sizing: border-box;
209201
}
210202

211203
.masonry-with-columns .masonry-component-frame {
212204
display: flex;
205+
width: 100%;
206+
height: 100%;
213207
flex-direction: column;
214208
align-items: center;
215209
justify-content: center;
216-
height: 100%;
217-
width: 100%;
218210
}

preview/assets/prism.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

preview/assets/theme.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");
22

33
body {
4-
margin: 0;
54
padding: 0;
6-
color: var(--text-color);
5+
margin: 0;
76
background-color: var(--background-color);
8-
font-family: "Inter", sans-serif;
7+
color: var(--text-color);
8+
font-family: Inter, sans-serif;
99
font-optical-sizing: auto;
10-
font-weight: 400;
1110
font-style: normal;
11+
font-weight: 400;
1212
}
1313

1414
@media (prefers-color-scheme: dark) {
@@ -37,8 +37,8 @@ body {
3737
--contrast-background-color: var(--dark, #e6e6e6) var(--light, #0d0d0d);
3838
--bright-text-color: var(--dark, #fafafa) var(--light, #000);
3939
--text-color: var(--dark, #d4d4d4) var(--light, #111);
40-
--dim-text-color: var(--dark, rgb(220, 220, 220))
41-
var(--light, rgb(43, 43, 43));
40+
--dim-text-color: var(--dark, rgb(220 220 220))
41+
var(--light, rgb(43 43 43));
4242
--border-color: var(--dark, #fff) var(--light, #000);
4343
--dim-border-color: var(--dark, #232323) var(--light, #e5e5e5);
4444
--muted-text-color: var(--dark, #a1a1a1) var(--light, #848484);

preview/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"dependencies": {
3+
"create-stylelint": "^0.5.0"
4+
},
5+
"devDependencies": {
6+
"stylelint": "^16.20.0",
7+
"stylelint-config-idiomatic-order": "^10.0.0",
8+
"stylelint-config-standard": "^38.0.0",
9+
"stylelint-order": "^6.0.4"
10+
}
11+
}

0 commit comments

Comments
 (0)