|
1 | 1 | <script lang="ts"> |
2 | 2 | let { data } = $props(); |
3 | 3 | let expandedArticles = $state(new Set<number>()); |
| 4 | + let subscribeOpen = $state(false); |
4 | 5 |
|
5 | 6 | // Stable color per feed name — hashes the name to pick a hue |
6 | 7 | function feedColor(name: string): string { |
|
45 | 46 | style={data.feedFilter === String(feed.id) ? `background: ${feedColor(feed.name)};` : `border: 1px solid ${feedColor(feed.name)}; color: ${feedColor(feed.name)}; background: transparent;`} |
46 | 47 | >{feed.name}</a> |
47 | 48 | {/each} |
48 | | - <a href={data.feedFilter ? `/feed/${data.feedFilter}/rss.xml` : '/rss.xml'} |
49 | | - class="rss-icon" title="Subscribe to this feed (RSS)"> |
50 | | - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 256 256"> |
51 | | - <rect width="256" height="256" rx="55" ry="55" fill="#f26522"/> |
52 | | - <circle cx="68" cy="189" r="28" fill="#fff"/> |
53 | | - <path d="M160 213h-34a82 82 0 0 0-82-82V97a116 116 0 0 1 116 116z" fill="#fff"/> |
54 | | - <path d="M224 213h-34a148 148 0 0 0-148-148V31a182 182 0 0 1 182 182z" fill="#fff"/> |
55 | | - </svg> |
56 | | - </a> |
| 49 | + <div class="subscribe-dropdown"> |
| 50 | + <button type="button" class="rss-icon" onclick={() => subscribeOpen = !subscribeOpen} title="Subscribe to this feed"> |
| 51 | + <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 256 256"> |
| 52 | + <rect width="256" height="256" rx="55" ry="55" fill="#f26522"/> |
| 53 | + <circle cx="68" cy="189" r="28" fill="#fff"/> |
| 54 | + <path d="M160 213h-34a82 82 0 0 0-82-82V97a116 116 0 0 1 116 116z" fill="#fff"/> |
| 55 | + <path d="M224 213h-34a148 148 0 0 0-148-148V31a182 182 0 0 1 182 182z" fill="#fff"/> |
| 56 | + </svg> |
| 57 | + </button> |
| 58 | + {#if subscribeOpen} |
| 59 | + <div class="subscribe-menu"> |
| 60 | + <a href={data.feedFilter ? `/feed/${data.feedFilter}/rss.xml` : '/rss.xml'}>RSS</a> |
| 61 | + <a href={data.feedFilter ? `/feed/${data.feedFilter}/atom.xml` : '/atom.xml'}>Atom</a> |
| 62 | + </div> |
| 63 | + {/if} |
| 64 | + </div> |
57 | 65 | </div> |
58 | 66 | <label> |
59 | 67 | <input type="checkbox" checked={data.showBoring} |
|
148 | 156 | .feed-tabs a { padding: 0.2rem 0.6rem; border-radius: 1rem; text-decoration: none; background: var(--color-border); color: var(--color-text); font-size: 0.8rem; transition: background 0.15s; } |
149 | 157 | .feed-tabs a:hover { background: var(--color-primary); color: white; } |
150 | 158 | .feed-tabs a.active { background: var(--color-primary); color: white; } |
151 | | - .rss-icon { display: inline-flex; align-items: center; background: none !important; padding: 0.2rem !important; } |
152 | | - .rss-icon:hover { background: none !important; opacity: 0.8; } |
| 159 | + .subscribe-dropdown { position: relative; display: inline-flex; } |
| 160 | + .rss-icon { display: inline-flex; align-items: center; background: none !important; padding: 0.2rem !important; border: none; cursor: pointer; } |
| 161 | + .rss-icon:hover { opacity: 0.8; } |
| 162 | + .subscribe-menu { |
| 163 | + position: absolute; top: 100%; right: 0; margin-top: 0.25rem; |
| 164 | + background: white; border: 1px solid var(--color-border); border-radius: 0.375rem; |
| 165 | + box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 10; min-width: 80px; |
| 166 | + display: flex; flex-direction: column; |
| 167 | + } |
| 168 | + .subscribe-menu a { |
| 169 | + display: block; padding: 0.4rem 0.75rem; text-decoration: none; |
| 170 | + font-size: 0.8rem; color: var(--color-text); |
| 171 | + } |
| 172 | + .subscribe-menu a:hover { background: #f0f4ff; color: var(--color-primary); } |
| 173 | + .subscribe-menu a:not(:last-child) { border-bottom: 1px solid var(--color-border); } |
153 | 174 | label { font-size: 0.8rem; white-space: nowrap; color: var(--color-muted); } |
154 | 175 |
|
155 | 176 | .diff-list { display: flex; flex-direction: column; gap: 1rem; } |
|
0 commit comments