diff --git a/src/components/FrameRenderer/FrameRenderer.astro b/src/components/FrameRenderer/FrameRenderer.astro index dc36267c3..949f7ee97 100644 --- a/src/components/FrameRenderer/FrameRenderer.astro +++ b/src/components/FrameRenderer/FrameRenderer.astro @@ -1,7 +1,7 @@ --- import Loader from '../Loader.astro'; -import ShareIcons from '../ShareIcons.astro'; -import TopicOverlay from '../TopicOverlay.astro'; +import ShareIcons from '../ShareIcons/ShareIcons.astro'; +import TopicOverlay from './TopicOverlay.astro'; import './FrameRenderer.css'; export interface Props { @@ -19,19 +19,14 @@ const { roadmapId, jsonUrl, dimensions = null, description } = Astro.props; -
-
- - -
- -
-
+ +
+
diff --git a/src/components/TopicOverlay.astro b/src/components/FrameRenderer/TopicOverlay.astro similarity index 96% rename from src/components/TopicOverlay.astro rename to src/components/FrameRenderer/TopicOverlay.astro index 5eb922e2c..94b8d9f66 100644 --- a/src/components/TopicOverlay.astro +++ b/src/components/FrameRenderer/TopicOverlay.astro @@ -1,6 +1,6 @@ --- -import Icon from './Icon.astro'; -import Loader from './Loader.astro'; +import Icon from '../Icon.astro'; +import Loader from '../Loader.astro'; export interface Props { roadmapId: string; diff --git a/src/components/FrameRenderer/renderer.js b/src/components/FrameRenderer/renderer.js index 4ea986c31..30d2227e0 100644 --- a/src/components/FrameRenderer/renderer.js +++ b/src/components/FrameRenderer/renderer.js @@ -1,6 +1,5 @@ import { wireframeJSONToSVG } from 'roadmap-renderer'; import { Topic } from './topic'; -import { Sharer } from './sharer'; /** * @typedef {{ roadmapId: string, jsonUrl: string }} RoadmapConfig @@ -104,7 +103,3 @@ renderer.init(); // Initialize the topic loader const topic = new Topic(); topic.init(); - -// Handles the share icons on the roadmap page -const sharer = new Sharer(); -sharer.init(); diff --git a/src/components/MarkdownFile.astro b/src/components/MarkdownFile.astro index 8729430ed..cb9afee4a 100644 --- a/src/components/MarkdownFile.astro +++ b/src/components/MarkdownFile.astro @@ -1,7 +1,5 @@ -
-
- -
+
+
diff --git a/src/components/ShareIcons.astro b/src/components/ShareIcons.astro deleted file mode 100644 index b85487a25..000000000 --- a/src/components/ShareIcons.astro +++ /dev/null @@ -1,43 +0,0 @@ ---- -import Icon from "./Icon.astro"; - -export interface Props { - pageUrl: string; - description: string; -} - -const { pageUrl, description } = Astro.props; - -const twitterUrl = `https://twitter.com/intent/tweet?text=${description}&url=${pageUrl}`; -const fbUrl = `https://www.facebook.com/sharer/sharer.php?quote=${description}&u=${pageUrl}`; -const hnUrl = `https://news.ycombinator.com/submitlink?t=${description}&u=${pageUrl}`; -const redditUrl = `https://www.reddit.com/submit?title=${description}&url=${pageUrl}`; ---- - - \ No newline at end of file diff --git a/src/components/ShareIcons/ShareIcons.astro b/src/components/ShareIcons/ShareIcons.astro new file mode 100644 index 000000000..f788c2ad2 --- /dev/null +++ b/src/components/ShareIcons/ShareIcons.astro @@ -0,0 +1,34 @@ +--- +import Icon from '../Icon.astro'; + +export interface Props { + pageUrl: string; + description: string; +} + +const { pageUrl, description } = Astro.props; + +const twitterUrl = `https://twitter.com/intent/tweet?text=${description}&url=${pageUrl}`; +const fbUrl = `https://www.facebook.com/sharer/sharer.php?quote=${description}&u=${pageUrl}`; +const hnUrl = `https://news.ycombinator.com/submitlink?t=${description}&u=${pageUrl}`; +const redditUrl = `https://www.reddit.com/submit?title=${description}&url=${pageUrl}`; +--- + + + + diff --git a/src/components/FrameRenderer/sharer.js b/src/components/ShareIcons/sharer.js similarity index 93% rename from src/components/FrameRenderer/sharer.js rename to src/components/ShareIcons/sharer.js index 9bd6c08a2..8bb12ca76 100644 --- a/src/components/FrameRenderer/sharer.js +++ b/src/components/ShareIcons/sharer.js @@ -27,3 +27,6 @@ export class Sharer { window.addEventListener('scroll', this.onScroll, { passive: true }); } } + +const sharer = new Sharer(); +sharer.init(); diff --git a/src/components/UpcomingForm.astro b/src/components/UpcomingForm.astro index 165406ecd..3d0764d27 100644 --- a/src/components/UpcomingForm.astro +++ b/src/components/UpcomingForm.astro @@ -3,22 +3,13 @@ import CaptchaFields from './Captcha/CaptchaFields.astro'; import Icon from './Icon.astro'; --- -
+
-

- Please check back later or subscribe below. -

+

Please check back later or subscribe below.

-
+ - { - !roadmapData.isUpcoming && roadmapData.jsonUrl && ( - - ) - } +
+ { + !roadmapData.isUpcoming && roadmapData.jsonUrl && ( +
+ - { - !roadmapData.isUpcoming && !roadmapData.jsonUrl && ( -
- - - -
- ) - } + +
+ ) + } - {roadmapData.isUpcoming && } + { + !roadmapData.isUpcoming && !roadmapData.jsonUrl && ( +
+ + + +
+ ) + } - + {roadmapData.isUpcoming && } - + + + +
diff --git a/src/pages/best-practices/[bestPracticeId].astro b/src/pages/best-practices/[bestPracticeId].astro index 81c81c7e1..53d2b2c11 100644 --- a/src/pages/best-practices/[bestPracticeId].astro +++ b/src/pages/best-practices/[bestPracticeId].astro @@ -3,6 +3,7 @@ import BestPracticeHeader from '../../components/BestPracticeHeader.astro'; import CaptchaScripts from '../../components/Captcha/CaptchaScripts.astro'; import FrameRenderer from '../../components/FrameRenderer/FrameRenderer.astro'; import MarkdownFile from '../../components/MarkdownFile.astro'; +import ShareIcons from '../../components/ShareIcons/ShareIcons.astro'; import UpcomingForm from '../../components/UpcomingForm.astro'; import BaseLayout from '../../layouts/BaseLayout.astro'; import { BestPracticeFrontmatter, getBestPracticeIds } from '../../lib/best-pratice'; @@ -57,24 +58,33 @@ if (bestPracticeData.schema) { isUpcoming={bestPracticeData.isUpcoming} /> - { - !bestPracticeData.isUpcoming && bestPracticeData.jsonUrl && ( - - ) - } +
+ { + !bestPracticeData.isUpcoming && bestPracticeData.jsonUrl && ( +
+ - { - !bestPracticeData.isUpcoming && !bestPracticeData.jsonUrl && ( - - - - ) - } + +
+ ) + } + + { + !bestPracticeData.isUpcoming && !bestPracticeData.jsonUrl && ( + + + + ) + } +
{bestPracticeData.isUpcoming && }