Skip to content

Commit 24dc16d

Browse files
committed
Move to client pattern in Social/Mastodon
1 parent 9aa40e9 commit 24dc16d

9 files changed

Lines changed: 16 additions & 19 deletions

File tree

‎.vscode/settings.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"jdbc",
4444
"Joomla",
4545
"jscoverage",
46+
"Karamov",
4647
"KHTML",
4748
"koko",
4849
"labelledby",

‎src/components/Social/Mastodon/__tests__/config.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
import { describe, it, expect } from 'vitest'
11-
import { mastodonConfig, buildShareUrl } from '@components/Social/Mastodon/config'
11+
import { mastodonConfig, buildShareUrl } from '@components/Social/Mastodon/client/config'
1212

1313
describe('Mastodon Configuration', () => {
1414
describe('mastodonConfig', () => {

‎src/components/Social/Mastodon/__tests__/detector.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010

1111
import { describe, it, expect, beforeEach, vi } from 'vitest'
12-
import { normalizeURL, getUrlDomain, getSoftwareName, isMastodonInstance } from '@components/Social/Mastodon/detector'
12+
import { normalizeURL, getUrlDomain, getSoftwareName, isMastodonInstance } from '@components/Social/Mastodon/client/detector'
1313

1414
// Type alias for mocked fetch function
1515
type MockedFetch = ReturnType<typeof vi.fn>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/components/Social/Mastodon/Modal.astro renamed to src/components/Social/Mastodon/index.astro

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ const { id = 'mastodon-modal' } = Astro.props
1515

1616
<div
1717
id={id}
18-
class="fixed inset-0 z-[9999] flex items-center justify-center p-4"
18+
class="fixed inset-0 z-9999 flex items-center justify-center p-4"
1919
role="dialog"
2020
aria-modal="true"
2121
aria-labelledby="modal-title"
2222
hidden
2323
>
2424
<div class="modal-backdrop absolute inset-0 bg-black/50 backdrop-blur-sm"></div>
2525
<div
26-
class="modal-content relative w-full max-w-2xl max-h-[90vh] overflow-auto bg-[var(--color-bg)] rounded-lg shadow-2xl"
26+
class="modal-content relative w-full max-w-2xl max-h-[90vh] overflow-auto bg-bg rounded-lg shadow-2xl"
2727
>
28-
<div class="flex items-center justify-between p-6 border-b border-[var(--color-border)]">
28+
<div class="flex items-center justify-between p-6 border-b border-border">
2929
<h2 id="modal-title" class="m-0 text-xl font-semibold">Share to Mastodon</h2>
3030
<button
3131
type="button"
32-
class="modal-close flex items-center justify-center w-8 h-8 p-0 border-0 bg-transparent rounded text-[var(--color-text-muted)] cursor-pointer transition-all duration-150 hover:bg-[var(--color-bg-muted)] hover:text-[var(--color-text)]"
32+
class="modal-close flex items-center justify-center w-8 h-8 p-0 border-0 bg-transparent rounded text-text-muted cursor-pointer transition-all duration-150 hover:bg-bg-muted hover:text-text"
3333
aria-label="Close modal"
3434
>
3535
<svg
@@ -54,7 +54,7 @@ const { id = 'mastodon-modal' } = Astro.props
5454
name="text"
5555
rows="4"
5656
readonly
57-
class="w-full p-3 border border-[var(--color-border)] rounded-md bg-[var(--color-bg-muted)] font-[inherit] text-sm leading-6 resize-y focus:outline-2 focus:outline-[var(--color-primary)] focus:outline-offset-2"
57+
class="w-full p-3 border border-border rounded-md bg-bg-muted font-[inherit] text-sm leading-6 resize-y focus:outline-2 focus:outline-primary focus:outline-offset-2"
5858
></textarea>
5959
</div>
6060

@@ -63,10 +63,10 @@ const { id = 'mastodon-modal' } = Astro.props
6363
<label for="mastodon-instance" class="flex flex-col gap-2 font-medium">
6464
<span>Mastodon Instance</span>
6565
<div
66-
class="flex items-stretch border border-[var(--color-border)] rounded-md overflow-hidden bg-[var(--color-bg-input)] focus-within:outline-2 focus-within:outline-[var(--color-primary)] focus-within:outline-offset-2"
66+
class="flex items-stretch border border-border rounded-md overflow-hidden bg-bg-input focus-within:outline-2 focus-within:outline-primary focus-within:outline-offset-2"
6767
>
6868
<span
69-
class="flex items-center px-3 py-2 bg-[var(--color-bg-muted)] text-[var(--color-text-muted)] text-sm select-none"
69+
class="flex items-center px-3 py-2 bg-bg-muted text-text-muted text-sm select-none"
7070
aria-label="https prefix"
7171
id="instance-prefix"
7272
>
@@ -79,14 +79,14 @@ const { id = 'mastodon-modal' } = Astro.props
7979
placeholder="mastodon.social"
8080
required
8181
aria-describedby="instance-prefix"
82-
class="flex-1 min-w-0 px-3 py-2 border-0 bg-transparent text-base text-[var(--color-text)] focus:outline-none"
82+
class="flex-1 min-w-0 px-3 py-2 border-0 bg-transparent text-base text-text focus:outline-none"
8383
/>
8484
</div>
8585
</label>
8686

8787
<!-- Saved Instances -->
8888
<div id="saved-instances" class="flex flex-col gap-2" style="display: none;">
89-
<p class="m-0 text-sm font-medium text-[var(--color-text-muted)]">Previously used:</p>
89+
<p class="m-0 text-sm font-medium text-text-muted">Previously used:</p>
9090
<div class="saved-list flex flex-wrap gap-2"></div>
9191
</div>
9292

@@ -101,13 +101,13 @@ const { id = 'mastodon-modal' } = Astro.props
101101
<div class="flex gap-3 justify-end">
102102
<button
103103
type="button"
104-
class="btn-secondary modal-cancel px-4 py-2 border border-[var(--color-border)] rounded-md font-medium cursor-pointer transition-all duration-150 bg-transparent text-[var(--color-text)] hover:bg-[var(--color-bg-muted)]"
104+
class="btn-secondary modal-cancel px-4 py-2 border border-border rounded-md font-medium cursor-pointer transition-all duration-150 bg-transparent text-text hover:bg-bg-muted"
105105
>
106106
Cancel
107107
</button>
108108
<button
109109
type="submit"
110-
class="btn-primary px-4 py-2 border-0 rounded-md font-medium cursor-pointer transition-all duration-150 bg-[var(--color-primary)] text-white hover:bg-[var(--color-primary-dark)] disabled:opacity-50 disabled:cursor-not-allowed"
110+
class="btn-primary px-4 py-2 border-0 rounded-md font-medium cursor-pointer transition-all duration-150 bg-primary text-white hover:bg-primary-dark disabled:opacity-50 disabled:cursor-not-allowed"
111111
>
112112
Share
113113
</button>

‎src/layouts/MarkdownLayout.astro‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import Featured from '@components/CallToAction/Featured/index.astro'
1717
import Newsletter from '@components/CallToAction/Newsletter/index.astro'
1818
import Carousel from '@components/Carousel/index.astro'
1919
import Embed from '@components/Social/Embed/index.astro'
20-
import Highlighter from '@components/Social/Highlighter/Highlighter.astro'
21-
import MastodonModal from '@components/Social/Mastodon/Modal.astro'
20+
import Highlighter from '@components/Social/Highlighter/index.astro'
21+
import MastodonModal from '@components/Social/Mastodon/index.astro'
2222
import Shares from '@components/Social/Shares/Shares.astro'
2323
import Icon from '@components/Icon/index.astro'
2424
import Testimonials from '@components/Testimonials/index.astro'
@@ -136,8 +136,4 @@ const baseLayoutProps = {
136136

137137
<!-- Mastodon sharing modal for Highlighter -->
138138
<MastodonModal />
139-
<script>
140-
import { registerShareHighlightWebComponent } from '@components/Social/Highlighter/share-highlight'
141-
registerShareHighlightWebComponent()
142-
</script>
143139
</BaseLayout>

0 commit comments

Comments
 (0)