@axium/contacts 0.2.9 → 0.3.0

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.
@@ -1,4 +1,4 @@
1
- import { fetchAPI, useCache } from '@axium/client';
1
+ import { fetchAPI, cache } from '@axium/client';
2
2
  export async function getContact(id) {
3
- return await useCache('contact', id, () => fetchAPI('GET', 'contacts/:id', {}, id));
3
+ return await cache.use('contact', id, () => fetchAPI('GET', 'contacts/:id', {}, id));
4
4
  }
@@ -207,6 +207,11 @@
207
207
  .contact-name-title {
208
208
  margin-left: 2em;
209
209
  font-size: 2em;
210
+
211
+ @media (width < 700px) {
212
+ margin-left: 0;
213
+ margin-top: 0.5em;
214
+ }
210
215
  }
211
216
 
212
217
  .contact-init-header,
@@ -218,6 +223,7 @@
218
223
 
219
224
  @media (width < 700px) {
220
225
  width: calc(100% - 2em);
226
+ padding: 1em;
221
227
  }
222
228
  }
223
229
 
@@ -226,6 +232,14 @@
226
232
  display: flex;
227
233
  gap: 1em;
228
234
  align-items: center;
235
+ flex-wrap: wrap;
236
+ }
237
+
238
+ .contact-init-header {
239
+ @media (width < 700px) {
240
+ flex-direction: column;
241
+ text-align: center;
242
+ }
229
243
  }
230
244
 
231
245
  .contact-init-actions > :not(span) {
@@ -238,7 +252,7 @@
238
252
 
239
253
  .contact-init {
240
254
  display: grid;
241
- grid-template-columns: 1em 1fr 1em;
255
+ grid-template-columns: 1em minmax(0, 1fr) 1em;
242
256
  gap: 1em;
243
257
  border-radius: 1em;
244
258
  background-color: var(--bg-menu);
@@ -270,8 +284,10 @@
270
284
  gap: 0.5em;
271
285
  grid-template-columns: 1fr;
272
286
 
273
- &.with-label {
274
- grid-template-columns: 1fr 1fr;
287
+ @media (width >= 700px) {
288
+ &.with-label {
289
+ grid-template-columns: 1fr 1fr;
290
+ }
275
291
  }
276
292
  }
277
293
 
@@ -280,8 +296,16 @@
280
296
  gap: 0.5em;
281
297
  grid-template-columns: 4em 1fr;
282
298
 
283
- &.with-label {
284
- grid-template-columns: 4em 1fr 1fr;
299
+ @media (width >= 700px) {
300
+ &.with-label {
301
+ grid-template-columns: 4em 1fr 1fr;
302
+ }
303
+ }
304
+
305
+ @media (width < 700px) {
306
+ &.with-label :global(> *:nth-child(3)) {
307
+ grid-column: 1 / -1;
308
+ }
285
309
  }
286
310
  }
287
311
  </style>
package/lib/List.svelte CHANGED
@@ -21,9 +21,9 @@
21
21
  <div class="list-item" onclick={() => (location.href = `/contacts/${contact.id}`)}>
22
22
  <ContactPicture {contact} />
23
23
  <span>{format.name(contact)}</span>
24
- <span>{format.emailDefault(contact)}</span>
25
- <span>{format.phoneDefault(contact)}</span>
26
- <span>{format.job(contact)}</span>
24
+ <span class="mobile-hide">{format.emailDefault(contact)}</span>
25
+ <span class="mobile-hide">{format.phoneDefault(contact)}</span>
26
+ <span class="mobile-hide">{format.job(contact)}</span>
27
27
  </div>
28
28
  {:else}
29
29
  <p class="list-empty">{text('contacts.list.empty')}</p>
@@ -34,4 +34,10 @@
34
34
  .list-item {
35
35
  grid-template-columns: 2em 2fr minmax(10em, 25em) minmax(10em, 20em) 1fr;
36
36
  }
37
+
38
+ @media (width < 700px) {
39
+ .list-item {
40
+ grid-template-columns: 2em 1fr;
41
+ }
42
+ }
37
43
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/contacts",
3
- "version": "0.2.9",
3
+ "version": "0.3.0",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "description": "Contacts for Axium",
6
6
  "funding": {
@@ -38,7 +38,7 @@
38
38
  "build": "tsc"
39
39
  },
40
40
  "peerDependencies": {
41
- "@axium/client": ">=0.25.0",
41
+ "@axium/client": ">=0.27.1",
42
42
  "@axium/core": ">=0.26.0",
43
43
  "@axium/server": ">=0.43.0",
44
44
  "@sveltejs/kit": "^2.27.3",
@@ -49,24 +49,24 @@
49
49
  </button>
50
50
  </a>
51
51
 
52
- <span></span>
52
+ <span class="mobile-hide"></span>
53
53
 
54
- <a href="/contacts/{contact.id}/edit">
54
+ <a class="mobile-hide" href="/contacts/{contact.id}/edit">
55
55
  <button class="icon-text">
56
56
  <Icon i="pencil" />
57
57
  <span>{text('contacts.edit')}</span>
58
58
  </button>
59
59
  </a>
60
60
 
61
- <button class="icon-text" command="show-modal" commandfor="delete-contact">
62
- <Icon i="trash" />
63
- <span>{text('contacts.delete')}</span>
64
- </button>
65
-
66
- <button class="icon-text" onclick={() => download(contactFileName + '.vcard', toVCard(contact))}>
61
+ <button class="icon-text mobile-hide" onclick={() => download(contactFileName + '.vcard', toVCard(contact))}>
67
62
  <Icon i="file-export" />
68
63
  <span>{text('contacts.export')}</span>
69
64
  </button>
65
+
66
+ <button class="icon-text mobile-hide" command="show-modal" commandfor="delete-contact">
67
+ <Icon i="trash" />
68
+ <span>{text('contacts.delete')}</span>
69
+ </button>
70
70
  </div>
71
71
 
72
72
  {#snippet part(i: string, value: string | false | 0 | null | undefined)}
@@ -182,6 +182,25 @@
182
182
  {@render part('regular/note', contact.notes)}
183
183
  </div>
184
184
 
185
+ <div class="contact-actions mobile-only">
186
+ <a href="/contacts/{contact.id}/edit">
187
+ <button class="icon-text">
188
+ <Icon i="pencil" />
189
+ <span>{text('contacts.edit')}</span>
190
+ </button>
191
+ </a>
192
+
193
+ <button class="icon-text" onclick={() => download(contactFileName + '.vcard', toVCard(contact))}>
194
+ <Icon i="file-export" />
195
+ <span>{text('contacts.export')}</span>
196
+ </button>
197
+
198
+ <button class="icon-text danger" command="show-modal" commandfor="delete-contact">
199
+ <Icon i="trash" />
200
+ <span>{text('contacts.delete')}</span>
201
+ </button>
202
+ </div>
203
+
185
204
  <FormDialog
186
205
  id="delete-contact"
187
206
  submitDanger
@@ -214,6 +233,11 @@
214
233
  .contact-name-title {
215
234
  margin-left: 2em;
216
235
  font-size: 2em;
236
+
237
+ @media (width < 700px) {
238
+ margin-left: 0;
239
+ margin-top: 0.5em;
240
+ }
217
241
  }
218
242
 
219
243
  .contact-header,
@@ -229,10 +253,42 @@
229
253
  }
230
254
 
231
255
  .contact-header,
232
- .contact-actions {
256
+ .contact-actions:not(.mobile-only) {
233
257
  display: flex;
234
258
  gap: 1em;
235
259
  align-items: center;
260
+ flex-wrap: wrap;
261
+ }
262
+
263
+ .contact-actions.mobile-only {
264
+ background-color: var(--bg-menu);
265
+ border-radius: 1em;
266
+ flex-direction: column;
267
+
268
+ @media (width < 700px) {
269
+ display: flex;
270
+ }
271
+
272
+ > :not(:first-child) {
273
+ border-top: var(--border-alt);
274
+ }
275
+
276
+ button {
277
+ background-color: var(--bg-menu);
278
+ border: none;
279
+ display: flex;
280
+ justify-content: flex-start;
281
+ width: 100%;
282
+ border-radius: 0;
283
+ padding: 1em;
284
+ }
285
+ }
286
+
287
+ .contact-header {
288
+ @media (width < 700px) {
289
+ flex-direction: column;
290
+ text-align: center;
291
+ }
236
292
  }
237
293
 
238
294
  .contact-actions a {
@@ -245,7 +301,7 @@
245
301
 
246
302
  .contact {
247
303
  display: grid;
248
- grid-template-columns: 1em 1fr;
304
+ grid-template-columns: 1em minmax(0, 1fr);
249
305
  gap: 1em;
250
306
  border-radius: 1em;
251
307
  background-color: var(--bg-menu);