From 6b4be3f0ab6e9d05297054b41e03491e63bad443 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Sun, 9 Apr 2023 05:56:07 +0100 Subject: [PATCH] Refactor login button --- .env.example | 1 + astro.config.mjs | 6 +- package.json | 2 +- .../{Icon.astro => AstroIcon.astro} | 3 +- src/components/BestPracticeHeader.astro | 2 +- src/components/FAQs/Question.astro | 2 +- src/components/Footer.astro | 2 +- src/components/Loader.astro | 2 +- src/components/Login/GithubLogin.astro | 8 +- src/components/Login/GoogleLogin.astro | 2 +- .../Navigation/AccountDropdown.astro | 2 +- src/components/Navigation/Navigation.astro | 2 +- src/components/OpenSourceBanner.astro | 2 +- src/components/Popup/Popup.astro | 2 +- src/components/RoadmapHeader.astro | 2 +- src/components/RoadmapHint.astro | 2 +- src/components/Setting/SettingSidebar.astro | 2 +- src/components/ShareIcons/ShareIcons.astro | 2 +- src/components/SocialAuth/GitHubButton.tsx | 92 +++++++++++++++++++ src/components/Sponsor/Sponsor.astro | 2 +- .../TopicOverlay/TopicOverlay.astro | 2 +- src/components/TopicSearch/TopicSearch.astro | 2 +- src/components/UpcomingForm.astro | 2 +- src/components/YouTubeBanner.astro | 2 +- src/env.d.ts | 1 + src/icons/spinner.svg | 6 +- src/pages/404.astro | 2 +- src/pages/signup.astro | 3 +- src/pages/verify.astro | 2 +- 29 files changed, 128 insertions(+), 34 deletions(-) create mode 100644 .env.example rename src/components/{Icon.astro => AstroIcon.astro} (93%) create mode 100644 src/components/SocialAuth/GitHubButton.tsx diff --git a/.env.example b/.env.example new file mode 100644 index 000000000..1e1b77ec2 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +PUBLIC_API_URL=http://api.roadmap.sh diff --git a/astro.config.mjs b/astro.config.mjs index 05f352c3b..de84afe7f 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,8 +1,8 @@ // https://astro.build/config import sitemap from '@astrojs/sitemap'; import tailwind from '@astrojs/tailwind'; -import compress from 'astro-compress'; import { defineConfig } from 'astro/config'; +import compress from 'astro-compress'; import rehypeExternalLinks from 'rehype-external-links'; import { serializeSitemap, shouldIndexPage } from './sitemap.mjs'; import preact from '@astrojs/preact'; @@ -28,7 +28,7 @@ export default defineConfig({ 'https://github.com/kamranahmedse', 'https://thenewstack.io', 'https://cs.fyi', - 'https://roadmap.sh' + 'https://roadmap.sh', ]; if (whiteListedStarts.some((start) => href.startsWith(start))) { @@ -58,6 +58,6 @@ export default defineConfig({ css: false, js: false, }), - preact(), + preact(), ], }); diff --git a/package.json b/package.json index 3f533c128..ed1123dbe 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,8 @@ "jose": "^4.13.1", "js-cookie": "^3.0.1", "node-html-parser": "^6.1.5", - "preact": "^10.13.2", "npm-check-updates": "^16.10.7", + "preact": "^10.13.2", "rehype-external-links": "^2.0.1", "roadmap-renderer": "^1.0.4", "tailwindcss": "^3.3.1" diff --git a/src/components/Icon.astro b/src/components/AstroIcon.astro similarity index 93% rename from src/components/Icon.astro rename to src/components/AstroIcon.astro index 7e0f77483..69251ebe2 100644 --- a/src/components/Icon.astro +++ b/src/components/AstroIcon.astro @@ -35,5 +35,4 @@ const { attributes: baseAttributes, innerHTML } = await getSVG(icon); const svgAttributes = { ...baseAttributes, ...attributes }; --- - - \ No newline at end of file + diff --git a/src/components/BestPracticeHeader.astro b/src/components/BestPracticeHeader.astro index 38ac3971f..504fff3f8 100644 --- a/src/components/BestPracticeHeader.astro +++ b/src/components/BestPracticeHeader.astro @@ -1,7 +1,7 @@ --- import BestPracticeHint from './BestPracticeHint.astro'; import DownloadPopup from './DownloadPopup.astro'; -import Icon from './Icon.astro'; +import Icon from './AstroIcon.astro'; import LoginPopup from './Login/LoginPopup.astro'; import SubscribePopup from './SubscribePopup.astro'; diff --git a/src/components/FAQs/Question.astro b/src/components/FAQs/Question.astro index 1ba53c113..e933aac0c 100644 --- a/src/components/FAQs/Question.astro +++ b/src/components/FAQs/Question.astro @@ -1,5 +1,5 @@ --- -import Icon from '../Icon.astro'; +import Icon from '../AstroIcon.astro'; export interface Props { question: string; diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 66621494a..b60d5ef2b 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -1,5 +1,5 @@ --- -import Icon from './Icon.astro'; +import Icon from './AstroIcon.astro'; ---
diff --git a/src/components/Loader.astro b/src/components/Loader.astro index 3e5406533..5b2293b85 100644 --- a/src/components/Loader.astro +++ b/src/components/Loader.astro @@ -1,5 +1,5 @@ --- -import Icon from './Icon.astro'; +import Icon from './AstroIcon.astro'; ---
diff --git a/src/components/Login/GithubLogin.astro b/src/components/Login/GithubLogin.astro index fec6a488c..dd3646f2f 100644 --- a/src/components/Login/GithubLogin.astro +++ b/src/components/Login/GithubLogin.astro @@ -1,5 +1,5 @@ --- -import Icon from '../Icon.astro'; +import Icon from '../AstroIcon.astro'; import Spinner from '../Spinner.astro'; --- @@ -8,10 +8,10 @@ import Spinner from '../Spinner.astro'; id='github-login-button' >