From b60bed4559f7c79669aaca88f81ca748c56bb088 Mon Sep 17 00:00:00 2001 From: Kamile Liucija Vainiute <kamile@igem.org> Date: Wed, 22 May 2024 08:58:35 +0000 Subject: [PATCH] Update 38 files - /src/components/AttributionForm/index.tsx - /src/components/Footer/index.tsx - /src/components/Header/index.tsx - /src/components/Inspirations/index.tsx - /src/components/Navbar/index.tsx - /src/components/NotFound/index.tsx - /src/utils/useDocumentTitle.ts - /src/contents/attributions.tsx - /src/contents/contribution.tsx - /src/contents/description.tsx - /src/contents/engineering.tsx - /src/contents/index.tsx - /src/contents/safety.tsx - /src/contents/education.tsx - /src/contents/entrepreneurship.tsx - /src/contents/experiments.tsx - /src/contents/hardware.tsx - /src/contents/home.tsx - /src/contents/human-practices.tsx - /src/contents/inclusivity.tsx - /src/contents/measurement.tsx - /src/contents/model.tsx - /src/contents/notebook.tsx - /src/contents/plant.tsx - /src/contents/results.tsx - /src/contents/software.tsx - /src/contents/sustainable.tsx - /src/contents/team.tsx - /src/components/Footer.tsx - /src/components/Header.tsx - /src/components/Inspirations.tsx - /src/components/Navbar.tsx - /src/components/NotFound.tsx - /src/components/index.tsx - /src/containers/App/App.tsx - /src/utils/stringToSlug.ts - /src/utils/getPathMapping.ts - /src/utils/index.ts --- src/components/AttributionForm/index.tsx | 28 ------------- .../{Footer/index.tsx => Footer.tsx} | 4 +- .../{Header/index.tsx => Header.tsx} | 4 +- .../index.tsx => Inspirations.tsx} | 3 +- .../{Navbar/index.tsx => Navbar.tsx} | 6 +-- src/components/NotFound.tsx | 16 ++++++++ src/components/NotFound/index.tsx | 20 ---------- src/components/index.tsx | 9 +++-- src/containers/App/App.tsx | 9 +++-- src/contents/attributions.tsx | 28 ++++++++++++- src/contents/contribution.tsx | 6 +-- src/contents/description.tsx | 8 ++-- src/contents/education.tsx | 6 +-- src/contents/engineering.tsx | 6 +-- src/contents/entrepreneurship.tsx | 5 +-- src/contents/experiments.tsx | 8 ++-- src/contents/hardware.tsx | 6 +-- src/contents/home.tsx | 8 ++-- src/contents/human-practices.tsx | 6 +-- src/contents/inclusivity.tsx | 6 +-- src/contents/index.tsx | 40 +++++++++---------- src/contents/measurement.tsx | 6 +-- src/contents/model.tsx | 8 ++-- src/contents/notebook.tsx | 8 ++-- src/contents/plant.tsx | 6 +-- src/contents/results.tsx | 6 +-- src/contents/safety.tsx | 4 +- src/contents/software.tsx | 6 +-- src/contents/sustainable.tsx | 8 ++-- src/contents/team.tsx | 8 ++-- src/utils/getPathMapping.ts | 4 +- src/utils/index.ts | 5 +-- src/utils/stringToSlug.ts | 2 +- src/utils/useDocumentTitle.ts | 9 ----- 34 files changed, 125 insertions(+), 187 deletions(-) delete mode 100644 src/components/AttributionForm/index.tsx rename src/components/{Footer/index.tsx => Footer.tsx} (98%) rename src/components/{Header/index.tsx => Header.tsx} (83%) rename src/components/{Inspirations/index.tsx => Inspirations.tsx} (90%) rename src/components/{Navbar/index.tsx => Navbar.tsx} (96%) create mode 100644 src/components/NotFound.tsx delete mode 100644 src/components/NotFound/index.tsx delete mode 100644 src/utils/useDocumentTitle.ts diff --git a/src/components/AttributionForm/index.tsx b/src/components/AttributionForm/index.tsx deleted file mode 100644 index dab5b7a..0000000 --- a/src/components/AttributionForm/index.tsx +++ /dev/null @@ -1,28 +0,0 @@ -function AttributionForm() { - const teamID = import.meta.env.VITE_TEAM_ID; - - // Listen to size change and update form height - window.addEventListener("message", function (e) { - if (e.origin === "https://teams.igem.org") { - const { type, data } = JSON.parse(e.data); - if (type === "igem-attribution-form") { - const element = document.getElementById("igem-attribution-form"); - if (element) { - element.style.height = `${data + 50}px`; - } - } - } - }); - - return ( - <> - <iframe - style={{ width: "100%" }} - id="igem-attribution-form" - src={`https://teams.igem.org/${teamID}/attributions`} - /> - </> - ); -} - -export default AttributionForm; diff --git a/src/components/Footer/index.tsx b/src/components/Footer.tsx similarity index 98% rename from src/components/Footer/index.tsx rename to src/components/Footer.tsx index e18b2c6..ea3ef18 100644 --- a/src/components/Footer/index.tsx +++ b/src/components/Footer.tsx @@ -1,6 +1,6 @@ import { stringToSlug } from "../../utils"; -function WikiFooter() { +export function Footer() { const teamYear = import.meta.env.VITE_TEAM_YEAR; const teamName = import.meta.env.VITE_TEAM_NAME; const teamSlug = stringToSlug(teamName); @@ -78,5 +78,3 @@ function WikiFooter() { </footer> ); } - -export default WikiFooter; diff --git a/src/components/Header/index.tsx b/src/components/Header.tsx similarity index 83% rename from src/components/Header/index.tsx rename to src/components/Header.tsx index f5018e3..f599004 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header.tsx @@ -5,7 +5,7 @@ interface HeaderProps { lead: string; } -const WikiHeader: React.FC<HeaderProps> = ({ title, lead }) => { +export function Header({ title, lead }: HeaderProps) { return ( <header className="bg-hero py-5 mb-5"> <div className="container h-100"> @@ -19,5 +19,3 @@ const WikiHeader: React.FC<HeaderProps> = ({ title, lead }) => { </header> ); }; - -export default WikiHeader; diff --git a/src/components/Inspirations/index.tsx b/src/components/Inspirations.tsx similarity index 90% rename from src/components/Inspirations/index.tsx rename to src/components/Inspirations.tsx index 05b9c0a..3273e37 100644 --- a/src/components/Inspirations/index.tsx +++ b/src/components/Inspirations.tsx @@ -11,7 +11,7 @@ interface InspirationsProps { inspirationLinkList: InspirationLink[]; } -const Inspirations: React.FC<InspirationsProps> = ({ inspirationLinkList }) => { +export function Inspirations ({ inspirationLinkList }: InspirationsProps) { return ( <> <div className="col-lg-4"> @@ -42,4 +42,3 @@ const Inspirations: React.FC<InspirationsProps> = ({ inspirationLinkList }) => { ); }; -export default Inspirations; diff --git a/src/components/Navbar/index.tsx b/src/components/Navbar.tsx similarity index 96% rename from src/components/Navbar/index.tsx rename to src/components/Navbar.tsx index f295fe2..75a558f 100644 --- a/src/components/Navbar/index.tsx +++ b/src/components/Navbar.tsx @@ -5,7 +5,7 @@ import NavDropdown from "react-bootstrap/NavDropdown"; import { Link } from "react-router-dom"; import Pages from "../../pages.ts"; -function WikiNavbar() { +export function Navbar() { const pages = Pages.map((item, pageIndex) => { if ("folder" in item && item.folder) { const folderItems = item.folder.map((subpage, subpageIndex) => { @@ -50,6 +50,4 @@ function WikiNavbar() { </Container> </Navbar> ); -} - -export default WikiNavbar; +} \ No newline at end of file diff --git a/src/components/NotFound.tsx b/src/components/NotFound.tsx new file mode 100644 index 0000000..e9f8f12 --- /dev/null +++ b/src/components/NotFound.tsx @@ -0,0 +1,16 @@ +import { Link } from "react-router-dom"; + +export function NotFound() { + return ( + <div className="d-flex flex-column justify-content-center align-items-center"> + <h1 className="not-found-title" style={{ fontSize: "100pt" }}> + 404 + </h1> + <div className="my-5"> + <Link to="/" className="btn btn-secondary btn-lg"> + Back to Home + </Link> + </div> + </div> + ); +} diff --git a/src/components/NotFound/index.tsx b/src/components/NotFound/index.tsx deleted file mode 100644 index 0df78af..0000000 --- a/src/components/NotFound/index.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { Link } from "react-router-dom"; - -function NotFound() { - return ( - <> - <div className="d-flex flex-column justify-content-center align-items-center"> - <h1 className="not-found-title" style={{ fontSize: "100pt" }}> - 404 - </h1> - <div className="my-5"> - <Link to="/" className="btn btn-secondary btn-lg"> - Back to Home - </Link> - </div> - </div> - </> - ); -} - -export default NotFound; diff --git a/src/components/index.tsx b/src/components/index.tsx index 9d15010..33a5bbd 100644 --- a/src/components/index.tsx +++ b/src/components/index.tsx @@ -1,4 +1,5 @@ -export { default as Navbar } from "./Navbar"; -export { default as Header } from "./Header"; -export { default as Footer } from "./Footer"; -export { default as NotFound } from "./NotFound"; +export * from "./Navbar"; +export * from "./Header"; +export * from "./Footer"; +export * from "./NotFound"; +export * from "./Inspirations"; diff --git a/src/containers/App/App.tsx b/src/containers/App/App.tsx index 622d79f..f943b49 100644 --- a/src/containers/App/App.tsx +++ b/src/containers/App/App.tsx @@ -2,7 +2,7 @@ import "./App.css"; import "bootstrap/dist/css/bootstrap.min.css"; import { Route, Routes } from "react-router-dom"; import { Footer, Header, Navbar, NotFound } from "../../components"; -import { getPathMapping, stringToSlug, useDocumentTitle } from "../../utils"; +import { getPathMapping, stringToSlug } from "../../utils"; const App = () => { const pathMapping = getPathMapping(); @@ -14,10 +14,12 @@ const App = () => { // Set Page Title const title = currentPath in pathMapping ? pathMapping[currentPath].title : "Not Found"; - useDocumentTitle(title); + + useEffect(() => { + document.title = `${title || ""} | ${import.meta.env.VITE_TEAM_NAME} - iGEM ${import.meta.env.VITE_TEAM_YEAR}`; + }, [title]); return ( - <> <> {/* Navigation */} <Navbar /> @@ -58,7 +60,6 @@ const App = () => { {/* MUST mention license AND have a link to team wiki's repository on gitlab.igem.org */} <Footer /> </> - </> ); }; diff --git a/src/contents/attributions.tsx b/src/contents/attributions.tsx index 11d919f..da8826c 100644 --- a/src/contents/attributions.tsx +++ b/src/contents/attributions.tsx @@ -1,6 +1,26 @@ -import AttributionForm from "../components/AttributionForm"; +import {useEffect} from 'react'; const Attributions = () => { + const teamID = import.meta.env.VITE_TEAM_ID; + + useEffect(() => { + function listenToIframeHeight(e) { + if (e.origin === "https://teams.igem.org") { + const { type, data } = JSON.parse(e.data); + if (type === "igem-attribution-form") { + const element = document.getElementById("igem-attribution-form"); + if (element) { + element.style.height = `${data + 50}px`; + } + } + } + } + window.addEventListener("message", listenToIframeHeight); + return () => { + window.removeEventListener("message", listenToIframeHeight) + } + }, []) + return ( <> <div className="row mt-4"> @@ -31,7 +51,11 @@ const Attributions = () => { </div> </div> </div> - <AttributionForm /> + <iframe + style={{ width: "100%" }} + id="igem-attribution-form" + src={`https://teams.igem.org/${teamID}/attributions`} + /> </> ); }; diff --git a/src/contents/contribution.tsx b/src/contents/contribution.tsx index c515e3c..407a694 100644 --- a/src/contents/contribution.tsx +++ b/src/contents/contribution.tsx @@ -1,4 +1,4 @@ -const Contribution = () => { +export function Contribution () { return ( <> <div className="row mt-4"> @@ -31,6 +31,4 @@ const Contribution = () => { </div> </> ); -}; - -export default Contribution; +}; \ No newline at end of file diff --git a/src/contents/description.tsx b/src/contents/description.tsx index 8b395b7..df7abe0 100644 --- a/src/contents/description.tsx +++ b/src/contents/description.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const Description = () => { +export function Description () { const links: InspirationLink[] = [ { year: 2022, teamName: "DTU-Denmark", pageName: "Description" }, { year: 2019, teamName: "ITESO_Guadalajara", pageName: "Description" }, @@ -76,6 +76,4 @@ const Description = () => { </div> </> ); -}; - -export default Description; +}; \ No newline at end of file diff --git a/src/contents/education.tsx b/src/contents/education.tsx index 3183416..09aab1b 100644 --- a/src/contents/education.tsx +++ b/src/contents/education.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const Education = () => { +export function Education () { const links: InspirationLink[] = [ { year: 2020, teamName: "CCA_San_Diego", pageName: "Education" }, { year: 2020, teamName: "Lambert_GA", pageName: "Education" }, @@ -47,5 +47,3 @@ const Education = () => { </> ); }; - -export default Education; diff --git a/src/contents/engineering.tsx b/src/contents/engineering.tsx index 6c1009f..42b77b3 100644 --- a/src/contents/engineering.tsx +++ b/src/contents/engineering.tsx @@ -1,4 +1,4 @@ -const Engineering = () => { +export function Engineering () { return ( <> <div className="row mt-4"> @@ -31,6 +31,4 @@ const Engineering = () => { </div> </> ); -}; - -export default Engineering; +}; \ No newline at end of file diff --git a/src/contents/entrepreneurship.tsx b/src/contents/entrepreneurship.tsx index 4311330..ea385ec 100644 --- a/src/contents/entrepreneurship.tsx +++ b/src/contents/entrepreneurship.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const Entrepreneurship = () => { +export function Entrepreneurship () { const links: InspirationLink[] = [ { year: 2019, teamName: "UCopenhagen", pageName: "Entrepreneurship" }, { year: 2019, teamName: "Thessaly", pageName: "Entrepreneurship" }, @@ -79,4 +79,3 @@ const Entrepreneurship = () => { ); }; -export default Entrepreneurship; diff --git a/src/contents/experiments.tsx b/src/contents/experiments.tsx index 40a5ee1..70a77e3 100644 --- a/src/contents/experiments.tsx +++ b/src/contents/experiments.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const Experiments = () => { +export function Experiments () { const links: InspirationLink[] = [ { year: 2019, teamName: "Nantes", pageName: "Experiments" }, { year: 2019, teamName: "TU_Eindhoven", pageName: "Experiments" }, @@ -31,6 +31,4 @@ const Experiments = () => { </div> </> ); -}; - -export default Experiments; +}; \ No newline at end of file diff --git a/src/contents/hardware.tsx b/src/contents/hardware.tsx index 481ff48..6b55828 100644 --- a/src/contents/hardware.tsx +++ b/src/contents/hardware.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const Hardware = () => { +export function Hardware () { const links: InspirationLink[] = [ { year: 2018, teamName: "Valencia_UPV", pageName: "Hardware" }, { year: 2018, teamName: "Unesp_Brazil", pageName: "Hardware" }, @@ -64,5 +64,3 @@ const Hardware = () => { </> ); }; - -export default Hardware; diff --git a/src/contents/home.tsx b/src/contents/home.tsx index c948e2f..c2455b5 100644 --- a/src/contents/home.tsx +++ b/src/contents/home.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const Home = () => { +export function Home () { const links: InspirationLink[] = [ { year: 2022, teamName: "DTU-Denmark", pageName: "" }, { year: 2022, teamName: "Virginia", pageName: "" }, @@ -104,6 +104,4 @@ const Home = () => { </div> </> ); -}; - -export default Home; +}; \ No newline at end of file diff --git a/src/contents/human-practices.tsx b/src/contents/human-practices.tsx index 6738b39..64242d5 100644 --- a/src/contents/human-practices.tsx +++ b/src/contents/human-practices.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const HumanPractices = () => { +export function HumanPractices () { const links: InspirationLink[] = [ { year: 2019, teamName: "Thessaly", pageName: "Human_Practices" }, { year: 2019, teamName: "Linkoping_Sweden", pageName: "Human_Practices" }, @@ -108,5 +108,3 @@ const HumanPractices = () => { </> ); }; - -export default HumanPractices; diff --git a/src/contents/inclusivity.tsx b/src/contents/inclusivity.tsx index d90639f..fe2ca54 100644 --- a/src/contents/inclusivity.tsx +++ b/src/contents/inclusivity.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const Inclusivity = () => { +export function Inclusivity () { const links: InspirationLink[] = [ { year: 2020, teamName: "Fudan", pageName: "Inclusion" }, { year: 2020, teamName: "CCU_Taiwan", pageName: "Inclusion" }, @@ -65,5 +65,3 @@ const Inclusivity = () => { </> ); }; - -export default Inclusivity; diff --git a/src/contents/index.tsx b/src/contents/index.tsx index f276a5f..1070578 100644 --- a/src/contents/index.tsx +++ b/src/contents/index.tsx @@ -1,25 +1,25 @@ -export { default as Home } from "./home.tsx"; +export * from "./home.tsx"; // Team -export { default as Team } from "./team.tsx"; -export { default as Attributions } from "./attributions.tsx"; +export * from "./team.tsx"; +export * from "./attributions.tsx"; // Project -export { default as Contribution } from "./contribution.tsx"; -export { default as Description } from "./description.tsx"; -export { default as Engineering } from "./engineering.tsx"; -export { default as Experiments } from "./experiments.tsx"; -export { default as Notebook } from "./notebook.tsx"; -export { default as Results } from "./results.tsx"; +export * from "./contribution.tsx"; +export * from "./description.tsx"; +export * from "./engineering.tsx"; +export * from "./experiments.tsx"; +export * from "./notebook.tsx"; +export * from "./results.tsx"; // Safety -export { default as Safety } from "./safety.tsx"; +export * from "./safety.tsx"; // Human Practices -export { default as HumanPractices } from "./human-practices.tsx"; +export * from "./human-practices.tsx"; // Awards -export { default as Education } from "./education.tsx"; -export { default as Entrepreneurship } from "./entrepreneurship.tsx"; -export { default as Hardware } from "./hardware.tsx"; -export { default as Inclusivity } from "./inclusivity.tsx"; -export { default as Measurement } from "./measurement.tsx"; -export { default as Model } from "./model.tsx"; -export { default as Plant } from "./plant.tsx"; -export { default as Software } from "./software.tsx"; -export { default as Sustainable } from "./sustainable.tsx"; +export * from "./education.tsx"; +export * from "./entrepreneurship.tsx"; +export * from "./hardware.tsx"; +export * from "./inclusivity.tsx"; +export * from "./measurement.tsx"; +export * from "./model.tsx"; +export * from "./plant.tsx"; +export * from "./software.tsx"; +export * from "./sustainable.tsx"; diff --git a/src/contents/measurement.tsx b/src/contents/measurement.tsx index 4081102..8655b87 100644 --- a/src/contents/measurement.tsx +++ b/src/contents/measurement.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const Measurement = () => { +export function Measurement () { const links: InspirationLink[] = [ { year: 2018, teamName: "UC_Davis", pageName: "Measurement" }, { year: 2019, teamName: "Newcastle", pageName: "Measurement" }, @@ -61,5 +61,3 @@ const Measurement = () => { </> ); }; - -export default Measurement; diff --git a/src/contents/model.tsx b/src/contents/model.tsx index 9339f84..d02b126 100644 --- a/src/contents/model.tsx +++ b/src/contents/model.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const Model = () => { +export function Model () { const links: InspirationLink[] = [ { year: 2018, teamName: "GreatBay_China", pageName: "Model" }, { year: 2018, teamName: "Leiden", pageName: "Model" }, @@ -65,6 +65,4 @@ const Model = () => { </div> </> ); -}; - -export default Model; +}; \ No newline at end of file diff --git a/src/contents/notebook.tsx b/src/contents/notebook.tsx index 699affd..072a2a8 100644 --- a/src/contents/notebook.tsx +++ b/src/contents/notebook.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const Notebook = () => { +export function Notebook () { const links: InspirationLink[] = [ { year: 2018, teamName: "Munich", pageName: "Notebook" }, { year: 2019, teamName: "Georgia_State", pageName: "Notebook" }, @@ -28,6 +28,4 @@ const Notebook = () => { </div> </> ); -}; - -export default Notebook; +}; \ No newline at end of file diff --git a/src/contents/plant.tsx b/src/contents/plant.tsx index 8da479e..03ad2c8 100644 --- a/src/contents/plant.tsx +++ b/src/contents/plant.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const Plant = () => { +export function Plant () { const links: InspirationLink[] = [ { year: 2018, teamName: "Cardiff_Wales", pageName: "Plant" }, { year: 2019, teamName: "Sorbonne_U_Paris", pageName: "Plant" }, @@ -47,5 +47,3 @@ const Plant = () => { </> ); }; - -export default Plant; diff --git a/src/contents/results.tsx b/src/contents/results.tsx index ee9ff04..9765501 100644 --- a/src/contents/results.tsx +++ b/src/contents/results.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const Results = () => { +export function Results () { const links: InspirationLink[] = [ { year: 2019, teamName: "Newcastle", pageName: "Results" }, { year: 2019, teamName: "Munich", pageName: "Results" }, @@ -79,5 +79,3 @@ const Results = () => { </> ); }; - -export default Results; diff --git a/src/contents/safety.tsx b/src/contents/safety.tsx index fb100c5..b342bc4 100644 --- a/src/contents/safety.tsx +++ b/src/contents/safety.tsx @@ -1,4 +1,4 @@ -const Safety = () => { +export function Safety () { return ( <> <div className="row mt-4"> @@ -90,5 +90,3 @@ const Safety = () => { </> ); }; - -export default Safety; diff --git a/src/contents/software.tsx b/src/contents/software.tsx index b6be4d3..b78d57b 100644 --- a/src/contents/software.tsx +++ b/src/contents/software.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const Software = () => { +export function Software () { const links: InspirationLink[] = [ { year: 2019, teamName: "Sydney_Australia", pageName: "Software" }, { year: 2019, teamName: "SMMU-China", pageName: "Software" }, @@ -52,5 +52,3 @@ const Software = () => { </> ); }; - -export default Software; diff --git a/src/contents/sustainable.tsx b/src/contents/sustainable.tsx index 013b7c5..8559aa2 100644 --- a/src/contents/sustainable.tsx +++ b/src/contents/sustainable.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const Sustainable = () => { +export function Sustainable () { const links: InspirationLink[] = [ { year: 2020, teamName: "Calgary", pageName: "Sustainable" }, { year: 2020, teamName: "Toulouse_INSA-UPS", pageName: "Sustainable" }, @@ -50,6 +50,4 @@ const Sustainable = () => { <Inspirations inspirationLinkList={links} /> </> ); -}; - -export default Sustainable; +}; \ No newline at end of file diff --git a/src/contents/team.tsx b/src/contents/team.tsx index 3dda179..9fd7f2d 100644 --- a/src/contents/team.tsx +++ b/src/contents/team.tsx @@ -1,6 +1,6 @@ -import Inspirations, { InspirationLink } from "../components/Inspirations"; +import { Inspirations, InspirationLink } from "../components"; -const Team = () => { +export function Team () { const links: InspirationLink[] = [ { year: 2019, teamName: "CU", pageName: "Team" }, { year: 2019, teamName: "UANL", pageName: "Team" }, @@ -78,6 +78,4 @@ const Team = () => { </div> </> ); -}; - -export default Team; +}; \ No newline at end of file diff --git a/src/utils/getPathMapping.ts b/src/utils/getPathMapping.ts index 0c0a6c2..950d76b 100644 --- a/src/utils/getPathMapping.ts +++ b/src/utils/getPathMapping.ts @@ -1,6 +1,6 @@ import pages from "../pages.ts"; -const getPathMapping = () => { +export const getPathMapping = () => { return pages.reduce<{ [key: string]: { name: string | undefined; @@ -31,5 +31,3 @@ const getPathMapping = () => { return map; }, {}); }; - -export default getPathMapping; diff --git a/src/utils/index.ts b/src/utils/index.ts index 2e75b30..feff56a 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,3 +1,2 @@ -export { default as getPathMapping } from "./getPathMapping"; -export { default as useDocumentTitle } from "./useDocumentTitle"; -export { default as stringToSlug } from "./stringToSlug"; +export * from "./getPathMapping"; +export * from "./stringToSlug"; diff --git a/src/utils/stringToSlug.ts b/src/utils/stringToSlug.ts index 97e668d..3fb7b55 100644 --- a/src/utils/stringToSlug.ts +++ b/src/utils/stringToSlug.ts @@ -1,4 +1,4 @@ -export default function stringToSlug(string: string): string { +export function stringToSlug(string: string): string { let slug = String(string).toLowerCase(); slug = slug.replace(/[^a-z0-9-]/g, "-"); slug = slug.replace(/-+/g, "-"); diff --git a/src/utils/useDocumentTitle.ts b/src/utils/useDocumentTitle.ts deleted file mode 100644 index 94d85aa..0000000 --- a/src/utils/useDocumentTitle.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { useEffect } from "react"; - -function useDocumentTitle(title: any) { - useEffect(() => { - document.title = `${title || ""} | ${import.meta.env.VITE_TEAM_NAME} - iGEM ${import.meta.env.VITE_TEAM_YEAR}`; - }, [title]); -} - -export default useDocumentTitle; -- GitLab