@portosaur/theme 0.1.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/package.json +10 -3
  2. package/src/plugins/theme.mjs +2 -0
  3. package/theme/DocCategoryGeneratedIndexPage/index.jsx +4 -10
  4. package/theme/MDXComponents.jsx +1 -1
  5. package/theme/Root.jsx +1 -1
  6. package/theme/components/AboutSection/index.jsx +89 -249
  7. package/theme/components/ContactSection/index.jsx +72 -153
  8. package/theme/components/ExperienceSection/index.jsx +35 -106
  9. package/theme/components/HeroSection/index.jsx +64 -186
  10. package/theme/components/NavArrow/index.jsx +38 -55
  11. package/theme/components/NoteIndex/index.jsx +50 -116
  12. package/theme/components/Preview/components/FeedbackStates.jsx +45 -190
  13. package/theme/components/Preview/components/FileTabs.jsx +17 -24
  14. package/theme/components/Preview/components/PreviewContent.jsx +37 -62
  15. package/theme/components/Preview/components/PreviewHeader.jsx +146 -380
  16. package/theme/components/Preview/components/Triggers/Pv.jsx +50 -78
  17. package/theme/components/Preview/components/Triggers/SrcPv.jsx +16 -47
  18. package/theme/components/Preview/components/Triggers/index.jsx +2 -2
  19. package/theme/components/Preview/components/ViewerWindow.jsx +160 -268
  20. package/theme/components/Preview/index.jsx +3 -3
  21. package/theme/components/Preview/renderers/CodeRenderer.jsx +81 -109
  22. package/theme/components/Preview/renderers/ImageRenderer.jsx +30 -67
  23. package/theme/components/Preview/renderers/PdfRenderer.jsx +31 -52
  24. package/theme/components/Preview/renderers/WebRenderer.jsx +18 -32
  25. package/theme/components/Preview/state/index.jsx +46 -30
  26. package/theme/components/ProjectsSection/index.jsx +278 -573
  27. package/theme/components/SocialLinks/index.jsx +43 -55
  28. package/theme/components/Tooltip/index.jsx +28 -39
  29. package/theme/pages/index.jsx +23 -87
  30. package/theme/pages/notes.jsx +26 -104
  31. package/theme/pages/tasks.jsx +220 -903
@@ -5,20 +5,27 @@ import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
5
5
  import useIsBrowser from "@docusaurus/useIsBrowser";
6
6
  import Tooltip from "../Tooltip";
7
7
  import { iconMap } from "../../config/iconMappings";
8
+
8
9
  const DEFAULT_ICON = FaQuestionCircle;
9
10
  const DEFAULT_COLOR = "var(--ifm-color-primary)";
11
+
10
12
  export default function SocialIcons({ showAll = false, links = null }) {
11
13
  const { siteConfig } = useDocusaurusContext();
12
14
  const { customFields } = siteConfig;
13
15
  const isBrowser = useIsBrowser();
14
16
  const [animationDelays, setAnimationDelays] = useState({});
15
- const allSocialLinks = customFields.socialLinks.links || [];
17
+
18
+ const allSocialLinks = customFields.socialSection?.links || [];
16
19
  const socialLinks = useMemo(() => {
17
20
  if (links) return links;
18
21
  return showAll ? allSocialLinks : allSocialLinks.filter((link) => link.pin);
19
22
  }, [allSocialLinks, showAll, links]);
23
+
20
24
  const calculateDelays = useCallback(() => {
21
- if (!isBrowser) return {};
25
+ if (!isBrowser) {
26
+ return {};
27
+ }
28
+
22
29
  const isTablet = window.innerWidth <= 768;
23
30
  const isMobile = window.innerWidth <= 480;
24
31
  const delays = {};
@@ -29,15 +36,15 @@ export default function SocialIcons({ showAll = false, links = null }) {
29
36
  });
30
37
  return delays;
31
38
  }, [isBrowser, socialLinks]);
39
+
32
40
  useEffect(() => {
33
41
  if (!isBrowser) return;
34
42
  setAnimationDelays(calculateDelays());
35
- const handleResize = () => {
36
- setAnimationDelays(calculateDelays());
37
- };
43
+ const handleResize = () => setAnimationDelays(calculateDelays());
38
44
  window.addEventListener("resize", handleResize);
39
45
  return () => window.removeEventListener("resize", handleResize);
40
46
  }, [isBrowser, calculateDelays]);
47
+
41
48
  const getIconDetails = (iconName) => {
42
49
  if (!iconName) {
43
50
  return { icon: DEFAULT_ICON, color: DEFAULT_COLOR };
@@ -52,64 +59,45 @@ export default function SocialIcons({ showAll = false, links = null }) {
52
59
  color: iconDetails.color || DEFAULT_COLOR,
53
60
  };
54
61
  };
62
+
55
63
  if (socialLinks.length === 0) {
56
64
  return null;
57
65
  }
58
- return jsxDEV_7x81h0kn(
59
- "div",
60
- {
61
- className: styles.socialIcons,
62
- children: socialLinks.map((social, index) => {
66
+
67
+ return (
68
+ <div className={styles.socialIcons}>
69
+ {socialLinks.map((social, index) => {
63
70
  const { icon: IconComponent, color: iconColor } = getIconDetails(
64
71
  social.icon || social.name,
65
72
  );
66
73
  const href = social.url || "#";
67
74
  const displayColor = social.color || iconColor;
68
- return jsxDEV_7x81h0kn(
69
- Tooltip,
70
- {
71
- msg: social.desc || social.name || social.icon || "Link",
72
- position: "top",
73
- bg: displayColor,
74
- underline: false,
75
- gap: 17,
76
- children: jsxDEV_7x81h0kn(
77
- "a",
78
- {
79
- href,
80
- target: "_blank",
81
- rel: "noopener noreferrer",
82
- className: styles.socialLink,
83
- style: {
84
- "--hover-color": displayColor,
85
- animationDelay: animationDelays[index] || "0s",
86
- },
87
- "aria-label": social.name || social.icon || "social link",
88
- children: jsxDEV_7x81h0kn(
89
- IconComponent,
90
- { size: 24 },
91
- undefined,
92
- false,
93
- undefined,
94
- this,
95
- ),
96
- },
97
- undefined,
98
- false,
99
- undefined,
100
- this,
101
- ),
102
- },
103
- index,
104
- false,
105
- undefined,
106
- this,
75
+
76
+ return (
77
+ <Tooltip
78
+ key={index}
79
+ msg={social.desc || social.name || social.icon || "Link"}
80
+ position="top"
81
+ bg={displayColor}
82
+ underline={false}
83
+ gap={17}
84
+ >
85
+ <a
86
+ href={href}
87
+ target="_blank"
88
+ rel="noopener noreferrer"
89
+ className={styles.socialLink}
90
+ style={{
91
+ "--hover-color": displayColor,
92
+ animationDelay: animationDelays[index] || "0s",
93
+ }}
94
+ aria-label={social.name || social.icon || "social link"}
95
+ >
96
+ <IconComponent size={24} />
97
+ </a>
98
+ </Tooltip>
107
99
  );
108
- }),
109
- },
110
- undefined,
111
- false,
112
- undefined,
113
- this,
100
+ })}
101
+ </div>
114
102
  );
115
103
  }
@@ -1,6 +1,7 @@
1
1
  import React, { useState, useRef, useCallback } from "react";
2
2
  import { createPortal } from "react-dom";
3
3
  import styles from "./styles.module.css";
4
+
4
5
  export default function Tooltip({
5
6
  children,
6
7
  msg,
@@ -17,9 +18,11 @@ export default function Tooltip({
17
18
  "Tooltip: 'msg' prop is required to display tooltip content.",
18
19
  );
19
20
  }
21
+
20
22
  const [isVisible, setIsVisible] = useState(false);
21
23
  const [coords, setCoords] = useState({ top: 0, left: 0 });
22
24
  const containerRef = useRef(null);
25
+
23
26
  const tooltipStyle = {
24
27
  ...(bg && { "--tooltip-color": bg }),
25
28
  ...(color && { "--tooltip-text-color": color }),
@@ -27,6 +30,7 @@ export default function Tooltip({
27
30
  bg && { "--tooltip-text-color": "var(--ifm-font-color-base-inverse)" }),
28
31
  ...(shadow && { "--tooltip-shadow": shadow }),
29
32
  };
33
+
30
34
  const show = useCallback(() => {
31
35
  if (!containerRef.current || !containerRef.current.children[0]) return;
32
36
  const rect = containerRef.current.children[0].getBoundingClientRect();
@@ -54,51 +58,36 @@ export default function Tooltip({
54
58
  setCoords({ top, left });
55
59
  setIsVisible(true);
56
60
  }, [position, gap]);
61
+
57
62
  const hide = useCallback(() => setIsVisible(false), []);
63
+
58
64
  const tooltip =
59
65
  isVisible && typeof document !== "undefined"
60
66
  ? createPortal(
61
- jsxDEV_7x81h0kn(
62
- "span",
63
- {
64
- className: `${styles.tooltip} ${styles[position]}`,
65
- style: { ...tooltipStyle, top: coords.top, left: coords.left },
66
- role: "tooltip",
67
- children: [
68
- msg,
69
- jsxDEV_7x81h0kn(
70
- "span",
71
- { className: styles.arrow },
72
- undefined,
73
- false,
74
- undefined,
75
- this,
76
- ),
77
- ],
78
- },
79
- undefined,
80
- true,
81
- undefined,
82
- this,
83
- ),
67
+ <span
68
+ className={`${styles.tooltip} ${styles[position]}`}
69
+ style={{ ...tooltipStyle, top: coords.top, left: coords.left }}
70
+ role="tooltip"
71
+ >
72
+ {msg}
73
+ <span className={styles.arrow} />
74
+ </span>,
84
75
  document.body,
85
76
  )
86
77
  : null;
87
- return jsxDEV_7x81h0kn(
88
- "div",
89
- {
90
- ref: containerRef,
91
- className: `${styles.tooltipContainer} ${underline ? styles.hasUnderline : ""} ${className}`,
92
- onMouseEnter: show,
93
- onMouseLeave: hide,
94
- onFocus: show,
95
- onBlur: hide,
96
- style: { display: "contents" },
97
- children: [children, tooltip],
98
- },
99
- undefined,
100
- true,
101
- undefined,
102
- this,
78
+
79
+ return (
80
+ <div
81
+ ref={containerRef}
82
+ className={`${styles.tooltipContainer} ${underline ? styles.hasUnderline : ""} ${className}`}
83
+ onMouseEnter={show}
84
+ onMouseLeave={hide}
85
+ onFocus={show}
86
+ onBlur={hide}
87
+ style={{ display: "contents" }}
88
+ >
89
+ {children}
90
+ {tooltip}
91
+ </div>
103
92
  );
104
93
  }
@@ -1,12 +1,13 @@
1
1
  import Layout from "@theme/Layout";
2
2
  import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
3
- import UpdateTitle from "../utils/updateTitle.js";
4
- import HeroSection from "../components/HeroSection/index.js";
5
- import AboutSection from "../components/AboutSection/index.js";
6
- import ProjectsSection from "../components/ProjectsSection/index.js";
7
- import ContactSection from "../components/ContactSection/index.js";
8
- import ExperienceSection from "../components/ExperienceSection/index.js";
9
- import NavArrow from "../components/NavArrow/index.js";
3
+ import UpdateTitle from "../utils/updateTitle.jsx";
4
+ import HeroSection from "../components/HeroSection/index.jsx";
5
+ import AboutSection from "../components/AboutSection/index.jsx";
6
+ import ProjectsSection from "../components/ProjectsSection/index.jsx";
7
+ import ContactSection from "../components/ContactSection/index.jsx";
8
+ import ExperienceSection from "../components/ExperienceSection/index.jsx";
9
+ import NavArrow from "../components/NavArrow/index.jsx";
10
+
10
11
  export default function Home() {
11
12
  const { siteConfig } = useDocusaurusContext();
12
13
 
@@ -17,88 +18,23 @@ export default function Home() {
17
18
  experience: `Experience | ${siteConfig.title}`,
18
19
  contact: `Contact | ${siteConfig.title}`,
19
20
  };
21
+
20
22
  const customStyles = `
21
23
  /* For future */
22
24
  `;
23
- return jsxDEV_7x81h0kn(
24
- Layout,
25
- {
26
- title: "Me",
27
- description: "My portfolio website",
28
- children: [
29
- jsxDEV_7x81h0kn(
30
- "style",
31
- { children: customStyles },
32
- undefined,
33
- false,
34
- undefined,
35
- this,
36
- ),
37
- jsxDEV_7x81h0kn(
38
- UpdateTitle,
39
- { sections: sectionTitles, defaultTitle: siteConfig.title },
40
- undefined,
41
- false,
42
- undefined,
43
- this,
44
- ),
45
- jsxDEV_7x81h0kn(
46
- "main",
47
- {
48
- children: [
49
- jsxDEV_7x81h0kn(
50
- HeroSection,
51
- { id: "me" },
52
- undefined,
53
- false,
54
- undefined,
55
- this,
56
- ),
57
- jsxDEV_7x81h0kn(
58
- AboutSection,
59
- { id: "about" },
60
- undefined,
61
- false,
62
- undefined,
63
- this,
64
- ),
65
- jsxDEV_7x81h0kn(
66
- ProjectsSection,
67
- { id: "projects" },
68
- undefined,
69
- false,
70
- undefined,
71
- this,
72
- ),
73
- jsxDEV_7x81h0kn(
74
- ExperienceSection,
75
- { id: "experience" },
76
- undefined,
77
- false,
78
- undefined,
79
- this,
80
- ),
81
- jsxDEV_7x81h0kn(
82
- ContactSection,
83
- { id: "contact" },
84
- undefined,
85
- false,
86
- undefined,
87
- this,
88
- ),
89
- jsxDEV_7x81h0kn(NavArrow, {}, undefined, false, undefined, this),
90
- ],
91
- },
92
- undefined,
93
- true,
94
- undefined,
95
- this,
96
- ),
97
- ],
98
- },
99
- undefined,
100
- true,
101
- undefined,
102
- this,
25
+
26
+ return (
27
+ <Layout title="Me" description="My portfolio website">
28
+ <style>{customStyles}</style>
29
+ <UpdateTitle sections={sectionTitles} defaultTitle={siteConfig.title} />
30
+ <main>
31
+ <HeroSection id="me" />
32
+ <AboutSection id="about" />
33
+ <ProjectsSection id="projects" />
34
+ <ExperienceSection id="experience" />
35
+ <ContactSection id="contact" />
36
+ <NavArrow />
37
+ </main>
38
+ </Layout>
103
39
  );
104
40
  }
@@ -1,8 +1,9 @@
1
1
  import Layout from "@theme/Layout";
2
- import NoteCards from "../components/NoteIndex/index.js";
2
+ import NoteCards from "../components/NoteIndex/index.jsx";
3
3
  import { usePluginData } from "@docusaurus/useGlobalData";
4
- import NavArrow from "../components/NavArrow/index.js";
5
- import HashNavigation from "../utils/HashNavigation.js";
4
+ import NavArrow from "../components/NavArrow/index.jsx";
5
+ import HashNavigation from "../utils/HashNavigation.jsx";
6
+
6
7
  const style = {
7
8
  notesContainer: { padding: "2rem 0", maxWidth: "1200px", margin: "0 auto" },
8
9
  pageTitle: {
@@ -19,113 +20,34 @@ const style = {
19
20
  marginBottom: "2rem",
20
21
  animation: "slideUp 0.5s ease-out 0.2s forwards",
21
22
  },
22
- "@keyframes slideUp": {
23
- from: { opacity: 0, transform: "translateY(20px)" },
24
- to: { opacity: 1, transform: "translateY(0)" },
25
- },
26
- "@media (prefers-reduced-motion: reduce)": {
27
- notesContainer: { animation: "none !important" },
28
- pageTitle: { animation: "none !important" },
29
- pageDescription: { animation: "none !important", opacity: 1 },
30
- },
31
23
  };
24
+
32
25
  export default function Notes() {
33
26
  const { path: docsBasePath } = usePluginData(
34
27
  "docusaurus-plugin-content-docs",
35
28
  );
36
29
  const pathName = docsBasePath.replace("/", "");
37
30
  const pageTitle = pathName.charAt(0).toUpperCase() + pathName.slice(1);
38
- return jsxDEV_7x81h0kn(
39
- Layout,
40
- {
41
- title: pageTitle,
42
- description: `My ${pageTitle}`,
43
- children: jsxDEV_7x81h0kn(
44
- "main",
45
- {
46
- style: style.notesContainer,
47
- children: jsxDEV_7x81h0kn(
48
- "div",
49
- {
50
- className: "container",
51
- children: [
52
- jsxDEV_7x81h0kn(
53
- "header",
54
- {
55
- className: "text-center mb-4",
56
- children: [
57
- jsxDEV_7x81h0kn(
58
- "h1",
59
- { style: style.pageTitle, children: "My Notes" },
60
- undefined,
61
- false,
62
- undefined,
63
- this,
64
- ),
65
- jsxDEV_7x81h0kn(
66
- "p",
67
- {
68
- style: style.pageDescription,
69
- children:
70
- "A collection of my self written notes & reference guides",
71
- },
72
- undefined,
73
- false,
74
- undefined,
75
- this,
76
- ),
77
- ],
78
- },
79
- undefined,
80
- true,
81
- undefined,
82
- this,
83
- ),
84
- jsxDEV_7x81h0kn(
85
- NoteCards,
86
- {},
87
- undefined,
88
- false,
89
- undefined,
90
- this,
91
- ),
92
- jsxDEV_7x81h0kn(
93
- NavArrow,
94
- {},
95
- undefined,
96
- false,
97
- undefined,
98
- this,
99
- ),
100
- jsxDEV_7x81h0kn(
101
- HashNavigation,
102
- {
103
- elementPrefix: "note-",
104
- elementSelector: ".note-card",
105
- effectDuration: 6000,
106
- },
107
- undefined,
108
- false,
109
- undefined,
110
- this,
111
- ),
112
- ],
113
- },
114
- undefined,
115
- true,
116
- undefined,
117
- this,
118
- ),
119
- },
120
- undefined,
121
- false,
122
- undefined,
123
- this,
124
- ),
125
- },
126
- undefined,
127
- false,
128
- undefined,
129
- this,
31
+
32
+ return (
33
+ <Layout title={pageTitle} description={`My ${pageTitle}`}>
34
+ <main style={style.notesContainer}>
35
+ <div className="container">
36
+ <header className="text-center mb-4">
37
+ <h1 style={style.pageTitle}>My Notes</h1>
38
+ <p style={style.pageDescription}>
39
+ A collection of my self written notes &amp; reference guides
40
+ </p>
41
+ </header>
42
+ <NoteCards />
43
+ <NavArrow />
44
+ <HashNavigation
45
+ elementPrefix="note-"
46
+ elementSelector=".note-card"
47
+ effectDuration={6000}
48
+ />
49
+ </div>
50
+ </main>
51
+ </Layout>
130
52
  );
131
53
  }