diff --git a/.github/workflows/deployment.yaml b/.github/workflows/deployment.yaml index 2121170bd97c..0bd3928a2b8c 100644 --- a/.github/workflows/deployment.yaml +++ b/.github/workflows/deployment.yaml @@ -8,11 +8,10 @@ on: jobs: build: - if: false runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.2.2 with: ref: rewrite/main @@ -25,17 +24,24 @@ jobs: - name: Install Node.js packages run: npm install - - name: Build site - run: npm run build + - name: Build stylesheets using Tailwind CSS + run: npm run-script tailwindcss -- --minify + + - name: Build React components using Webpack + run: npm run-script webpack -- --mode=production + + - name: Build site using Jekyll + env: + JEKYLL_ENV: production + run: npm run-script jekyll:build -- --baseurl ${{ github.event.repository.name }} - name: Upload artifact id: deployment - uses: actions/upload-pages-artifact@3 + uses: actions/upload-pages-artifact@v3.0.1 with: path: dist/ deploy: - if: false runs-on: ubuntu-latest needs: build @@ -50,4 +56,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@4 + uses: actions/deploy-pages@v4.0.5 diff --git a/.vscode/settings.json b/.vscode/settings.json index f7af08199c46..972819d29020 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { "files.associations": { - "**/content/**/*.html": "liquid" + "**/content/**/*.{html,js}": "liquid", } -} \ No newline at end of file +} diff --git a/content/site.js b/content/site.js index 80834078b0fb..9a6a2fe57d21 100644 --- a/content/site.js +++ b/content/site.js @@ -1,5 +1,25 @@ --- --- +{%- assign values = site.data.site-constants -%} + +{%- capture constants -%} +{ + "logo": "{{ values.logo | relative_url }}", + "baseUrl": "{{ site.baseurl }}", + "topNav": [ + { "title": "Home", "href": "{{ site.baseurl }}", "key": 0 }, + { "title": "Blogs and instructions", "href": "{{ '/publications' | relative_url }}", "key": 1 }, + { "title": "Status", "href": "{{ '/status' | relative_url }}", "key": 2 }, + { "title": "Events", "href": "{{ '/events' | relative_url }}", "key": 3 }, + { "title": "Search", "href": "{{ '/search' | relative_url }}", "key": 4 } + ], + "cardNav": [ + { "title": "How to get access", "href": "{{ '/access' | relative_url }}", "key": 5 }, + { "title": "Blogs and instructions", "href": "{{ '/publications' | relative_url }}", "key": 6 }, + { "title": "About FiQCI", "href": "{{ '/about' | relative_url }}", "key": 7 } + ] +} +{%- endcapture -%} {%- capture publications -%} [ @@ -37,7 +57,7 @@ "key": "{{ forloop.index }}", "type": "Event", "title": "{{ event_post.title }}", - "url": "{{ event_post.link }}", + "url": "{{ event_post.link | relative_url }}", "date": "{{ event_post.date | date: '%-d.%-m.%Y' }}", "content": {{ event_post.content | strip_html | strip_newlines | jsonify }}, "filters": { @@ -60,6 +80,7 @@ {%- endcapture -%} const SITE = { + constants: JSON.parse(String.raw`{{- constants -}}`), publications: JSON.parse(String.raw`{{- publications -}}`), events: JSON.parse(String.raw`{{- events -}}`), } diff --git a/src/components/Home.jsx b/src/components/Home.jsx index 6eef2c89c1f6..ad647dd753de 100644 --- a/src/components/Home.jsx +++ b/src/components/Home.jsx @@ -10,8 +10,8 @@ const style = { "--_c-icon-color": "white" }; -const ContentButton = ({ text, href, icon=mdiArrowDown }) => { - const isActive = window.location.pathname === href; +const ContentButton = props => { + const isActive = window.location.pathname === props.href; var styleClass = "text-white text-md py-3" if (isActive) { @@ -23,16 +23,25 @@ const ContentButton = ({ text, href, icon=mdiArrowDown }) => { className='w-min ml-0 mt-[10px] md:ml-0 mr-[20px] sm:ml-0 bg-[#0D2B53] hover:bg-blue-600' no-radius style={style} - - onClick={() => (window.location.href = href)} + onClick={() => (window.location.href = props.href)} > -

{text}

- +

{props.title}

+ ); }; export const Home = () => { + const test_lg = 500; + const test = 'flex flex-col justify-evenly z-2 bg-orange-200 min-h-[100px] pl-[30px]' + const nav = SITE.constants.cardNav + const contentButtons = [ + ["How to get access", mdiArrowDown], + ["Blogs and instructions", mdiArrowRight], + ["About FiQCI", mdiArrowRight], + ].map(([title, icon]) => [nav.find(page => page.title === title), icon]) + .map(([page, icon]) => ) + return (
@@ -49,14 +58,12 @@ export const Home = () => {
-
+

Open call for pilot access to Helmi quantum computer now open!

- How to access Helmi, instructions + How to access Helmi, instructions
- - - + { contentButtons }
diff --git a/src/components/NavigationHeader.jsx b/src/components/NavigationHeader.jsx index 2a6a1a067491..bb4669ad6229 100644 --- a/src/components/NavigationHeader.jsx +++ b/src/components/NavigationHeader.jsx @@ -10,47 +10,51 @@ const style = { "--_c-icon-color": "black" }; -const NavButton = ({ text, href }) => { - const isActive = window.location.pathname === href; - let styleClass = "text-black py-2"; - if (isActive) { - styleClass += " underline underline-offset-8 decoration-2"; - } +const NavButton = props => { + const isActive = window.location.pathname === props.href; - return ( - (window.location.href = href)} - > -

{text}

-
- ); + let styleClass = "text-black py-2" + if (isActive) { + styleClass = styleClass + " underline underline-offset-8 decoration-2" + } + + return ( + (window.location.href = props.href)} + > +

{props.title}

+
+ ); }; -const NavSearchButton = ({ text, href }) => { +const NavSearchButton = props => { return ( -
(window.location.href = href)} + onClick={() => (window.location.href = props.href)} > -

{text}

+

{props.title}

-
); }; export const NavigationHeader = () => { - const [isOpen, setIsOpen] = useState(false); - const navRef = useRef(null); + const [isOpen, setIsOpen] = useState(false); + const navRef = useRef(null); + const toggleMenu = () => setIsOpen((prev) => !prev); - const toggleMenu = () => setIsOpen((prev) => !prev); + const pageButtons = SITE.constants.topNav.map( + page => page.title != "Search" + && + || + ); // This effect adds event listeners when the menu is open. // It will close the menu if a click or touch happens outside the navbar. @@ -61,7 +65,7 @@ export const NavigationHeader = () => { } } if (isOpen) { //stop main content from scrolling when navigation menu open - document.body.style.overflow = 'hidden'; + document.body.style.overflow = 'hidden'; document.addEventListener("mousedown", handleClickOutside); document.addEventListener("touchstart", handleClickOutside); } @@ -76,45 +80,33 @@ export const NavigationHeader = () => { }; }, [isOpen]); - return ( - // Attach the ref here so clicks inside this container won't close the menu. -
-
-
- - Logo - -
- - {/* Desktop navigation */} -
- - - - - -
- - {/* Mobile menu toggle */} -
- -
-
- {/* Mobile navigation menu */} - {isOpen && ( -
- - - - - + return ( +
+
+
+ + Logo + +
+ +
+ { pageButtons } +
+ +
+ +
+
+ {isOpen && +
+ { pageButtons } +
+ }
- )} -
- ); + ); };