-
-
Notifications
You must be signed in to change notification settings - Fork 39
[codex] add sponsor feed to docs #608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,122 @@ | ||||||
| <template> | ||||||
| <section | ||||||
| v-if="sponsors.length" | ||||||
| aria-labelledby="endev-sponsors-title" | ||||||
| class="EndevSponsors" | ||||||
| > | ||||||
| <div class="EndevSponsorsInner"> | ||||||
| <p id="endev-sponsors-title" class="EndevSponsorsTitle"> | ||||||
| Company sponsors | ||||||
| </p> | ||||||
| <div class="EndevSponsorsLogos"> | ||||||
| <a | ||||||
| v-for="sponsor in sponsors" | ||||||
| :key="sponsor.name" | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| :aria-label="sponsor.name" | ||||||
| class="EndevSponsorsLogo" | ||||||
| :href="sponsor.url" | ||||||
| rel="noopener noreferrer" | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| target="_blank" | ||||||
| > | ||||||
| <img :alt="sponsor.name" :src="sponsor.logo" /> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The existing
Suggested change
|
||||||
| </a> | ||||||
| </div> | ||||||
| <a class="EndevSponsorsCta" href="https://en.dev/#contact"> | ||||||
| Sponsor the work | ||||||
| </a> | ||||||
| </div> | ||||||
| </section> | ||||||
| </template> | ||||||
|
|
||||||
| <script setup> | ||||||
| import { onMounted, ref } from "vue"; | ||||||
|
|
||||||
| const sponsors = ref([]); | ||||||
|
|
||||||
| onMounted(async () => { | ||||||
| try { | ||||||
| const res = await fetch("https://en.dev/sponsors.json", { | ||||||
| headers: { Accept: "application/json" }, | ||||||
| }); | ||||||
| if (!res.ok) return; | ||||||
|
|
||||||
| const payload = await res.json(); | ||||||
| sponsors.value = (Array.isArray(payload.sponsors) ? payload.sponsors : []) | ||||||
| .filter((sponsor) => | ||||||
| sponsor?.kind !== "infrastructure" && | ||||||
| sponsor?.name && | ||||||
| sponsor?.url && | ||||||
| sponsor?.logo | ||||||
| ); | ||||||
| } catch { | ||||||
| sponsors.value = []; | ||||||
| } | ||||||
| }); | ||||||
|
Comment on lines
+31
to
+54
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The project uses TypeScript in other theme files (e.g., |
||||||
| </script> | ||||||
|
|
||||||
| <style scoped> | ||||||
| .EndevSponsors { | ||||||
| border-top: 1px solid var(--vp-c-divider); | ||||||
| padding: 22px 24px; | ||||||
| } | ||||||
|
|
||||||
| .EndevSponsorsInner { | ||||||
| align-items: center; | ||||||
| display: flex; | ||||||
| flex-wrap: wrap; | ||||||
| gap: 12px 18px; | ||||||
| justify-content: center; | ||||||
| margin: 0 auto; | ||||||
| max-width: 960px; | ||||||
| } | ||||||
|
|
||||||
| .EndevSponsorsTitle { | ||||||
| color: var(--vp-c-text-2); | ||||||
| font-size: 13px; | ||||||
| font-weight: 600; | ||||||
| margin: 0; | ||||||
| text-transform: uppercase; | ||||||
| } | ||||||
|
|
||||||
| .EndevSponsorsLogos { | ||||||
| align-items: center; | ||||||
| display: flex; | ||||||
| flex-wrap: wrap; | ||||||
| gap: 10px; | ||||||
| justify-content: center; | ||||||
| } | ||||||
|
|
||||||
| .EndevSponsorsLogo { | ||||||
| align-items: center; | ||||||
| border: 1px solid var(--vp-c-divider); | ||||||
| border-radius: 8px; | ||||||
| display: inline-flex; | ||||||
| height: 40px; | ||||||
| justify-content: center; | ||||||
| padding: 8px 12px; | ||||||
| transition: border-color 0.2s ease, background-color 0.2s ease; | ||||||
| } | ||||||
|
|
||||||
| .EndevSponsorsLogo:hover { | ||||||
| background: var(--vp-c-bg-soft); | ||||||
| border-color: var(--vp-c-brand-1); | ||||||
| } | ||||||
|
|
||||||
| .EndevSponsorsLogo img { | ||||||
| display: block; | ||||||
| max-height: 22px; | ||||||
| max-width: 120px; | ||||||
| } | ||||||
|
|
||||||
| .EndevSponsorsCta { | ||||||
| color: var(--vp-c-text-2); | ||||||
| font-size: 13px; | ||||||
| font-weight: 500; | ||||||
| text-decoration: none; | ||||||
| transition: color 0.2s ease; | ||||||
| } | ||||||
|
|
||||||
| .EndevSponsorsCta:hover { | ||||||
| color: var(--vp-c-brand-1); | ||||||
| } | ||||||
| </style> | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hrefsponsor.urlis inserted directly into the anchor'shrefwith only a truthiness check. Ajavascript:…value would pass that check and execute in the visitor's browser if theen.dev/sponsors.jsonfeed is ever compromised or returns unexpected data. The existingEndevFooter.vuehardcodes its URL precisely to avoid this, so the same level of safety should apply here.And add a helper in
<script setup>: