Skip to content

Commit

Permalink
Merge pull request #23 from she-code-africa/Code_Playground
Browse files Browse the repository at this point in the history
update: codeplaygroundpage
  • Loading branch information
EseAlli authored Jul 29, 2024
2 parents 61f45cb + 308d94a commit 57cddb1
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 92 deletions.
8 changes: 4 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
RoboticsPage,
GameDevelopment,
ContactUsPage,
CodePlaygroundPage,
} from "./pages";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ToastContainer } from "react-toastify";
Expand All @@ -32,19 +33,18 @@ function App() {
}
}
}, []);

return (
<QueryClientProvider client={queryClient}>
<Routes>
<Route path="/" element={<HomePage />} />
<Route path="/outreach" element={<OutreachPage />} />
<Route path="/activities/coding" element={<CodingPage />} />
<Route path="/activities/robotics" element={<RoboticsPage />} />
<Route
path="/activities/game-development"
element={<GameDevelopment />}
/>
<Route path="/activities/game-development" element={<GameDevelopment />} />
<Route path="/stem-clubs" element={<StemClubs />} />
<Route path="/contact-us" element={<ContactUsPage />} />
<Route path="/code-playground" element={<CodePlaygroundPage />} />
</Routes>
<ToastContainer />
</QueryClientProvider>
Expand Down
90 changes: 5 additions & 85 deletions src/components/activities/ReadyToCode.jsx
Original file line number Diff line number Diff line change
@@ -1,90 +1,12 @@
import React, { useState } from "react";
import React from "react";
import { Link } from "react-router-dom";
import Modal from "react-modal";
import { FaAngleRight, FaCheck, FaExternalLinkAlt } from "react-icons/fa";
import { FaAngleRight,} from "react-icons/fa";
import { starImage } from "../../assets/images";

const CodePlayground = ({ isOpen, onClose }) => {
return (
<Modal
isOpen={isOpen}
onRequestClose={onClose}
contentLabel="Code Playground"
className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center overflow-y-auto"
overlayClassName=" fixed inset-0 bg-black bg-opacity-50"
>
<div className="bg-white py-7 lg:px-16 px-5 rounded-lg max-w-[90%] w-full lg:top-64 top-[400px] md:top-[200px] z-50 relative ">
<div className="flex justify-between">
<button
className=" hover:text-primaryPink transition-all"
onClick={onClose}
>
Back
</button>
<a
href="https://codeplayground.vercel.app/"
target="_blank"
rel="noopener noreferrer"
className="hover:text-primaryPink transition-all"
>
<FaExternalLinkAlt />
</a>
</div>
<h2 className="text-2xl md:text-3xl lg:text-4xl mb-4 text-center ">
Explore Code Playground
</h2>
<div className="flex mb-5 lg:justify-center flex-wrap gap-2 w-full">
<div className="flex items-center gap-2 ">
<span className="text-primaryPink">
<FaCheck />
</span>
<p>HTML: The Building Blocks of Websites</p>
</div>
<div className="flex items-center gap-2 ">
<span className="text-primaryPink">
<FaCheck />
</span>
<p>CSS: Style Your Website Like a Pro</p>
</div>
<div className="flex items-center gap-2 ">
<span className="text-primaryPink">
<FaCheck />
</span>
<p>JavaScript: Bring Your Website to Life</p>
</div>
</div>
<h2 className="font-semibold text-lg my-4">Description</h2>
<hr className="border-primaryPink mb-5" />
<p className="mb-10">
This Playground allows you to experiment with code without having to
set up your own development environment. You can write HTML code to
structure the content of your webpage, CSS code to style the
appearance of your webpage, and JavaScript code to add interactivity
to your webpage. The playground will then execute your code and
display the results in a preview pane.
</p>
<div className="h-[70vh] overflow-y-auto mb-10">
<iframe
src="https://codeplayground.vercel.app/"
style={{ width: "100%", height: "100%", border: "none" }}
title="Code Playground"
></iframe>
</div>
</div>
</Modal>
);
};

const ReadyToCode = () => {
const [isLightboxOpen, setIsLightboxOpen] = useState(false);

const openLightbox = () => {
setIsLightboxOpen(true);
};

const closeLightbox = () => {
setIsLightboxOpen(false);
};
const ReadyToCode = () => {


return (
<section
Expand All @@ -105,9 +27,8 @@ const ReadyToCode = () => {
</p>
<div className="flex justify-center my-7">
<Link
to="#"
to="/code-playground"
className="text-white capitalize w-full max-w-[250px] h-[53px] rounded-[30px] text-sm flex items-center justify-center bg-primaryPink border-2 border-primaryPink hover:bg-transparent hover:text-primaryPink transition-all gap-2"
onClick={openLightbox}
>
Click here to explore
<span className="text-sm flex items-center justify-center w-[24px] h-[24px] rounded-[50%] bg-white text-primaryPink">
Expand All @@ -117,7 +38,6 @@ const ReadyToCode = () => {
</div>
</div>
<img src={starImage} alt="" className="max-md:hidden right-64 bottom-16 absolute" />
<CodePlayground isOpen={isLightboxOpen} onClose={closeLightbox} />

</section>
);
Expand Down
67 changes: 67 additions & 0 deletions src/components/activities/code-playground/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import React from "react";
import { FaCheck, FaExternalLinkAlt } from "react-icons/fa";

const CodePlayground = () => {
return (
<div className="bg-white py-7 lg:px-16 px-5 rounded-lg max-w-[90%] w-full mx-auto mt-7">
<div className="flex justify-between lg:mb-2 mb-10 ">
<a
href="/activities/coding"
className="hover:text-primaryPink transition-all"
>
Back
</a>
<a
href="https://codeplayground.vercel.app/"
target="_blank"
rel="noopener noreferrer"
className="hover:text-primaryPink transition-all"
>
<FaExternalLinkAlt />
</a>
</div>
<h2 className="text-2xl md:text-3xl lg:text-4xl mb-7 text-center">
Explore Code Playground
</h2>
<div className="flex mb-5 lg:justify-center flex-wrap gap-2 w-full">
<div className="flex items-center gap-2">
<span className="text-primaryPink">
<FaCheck />
</span>
<p>HTML: The Building Blocks of Websites</p>
</div>
<div className="flex items-center gap-2">
<span className="text-primaryPink">
<FaCheck />
</span>
<p>CSS: Style Your Website Like a Pro</p>
</div>
<div className="flex items-center gap-2">
<span className="text-primaryPink">
<FaCheck />
</span>
<p>JavaScript: Bring Your Website to Life</p>
</div>
</div>
<h2 className="font-semibold text-lg my-4">Description</h2>
<hr className="border-primaryPink mb-5" />
<p className="mb-10">
This Playground allows you to experiment with code without having to
set up your own development environment. You can write HTML code to
structure the content of your webpage, CSS code to style the appearance
of your webpage, and JavaScript code to add interactivity to your
webpage. The playground will then execute your code and display the
results in a preview pane.
</p>
<div className="h-[70vh] overflow-y-auto mb-10">
<iframe
src="https://codeplayground.vercel.app/"
style={{ width: "100%", height: "100%", border: "none" }}
title="Code Playground"
></iframe>
</div>
</div>
);
};

export default CodePlayground;
4 changes: 1 addition & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ import App from "./App";
import reportWebVitals from "./reportWebVitals";
import { BrowserRouter as Router } from "react-router-dom";
import ReactGA from "react-ga4";
import Modal from "react-modal";

// Initialize Google Analytics
ReactGA.initialize(process.env.REACT_APP_G_TAG_ID);

// Set the app element for react-modal
Modal.setAppElement('#root');


const root = ReactDOM.createRoot(document.getElementById("root"));

Expand Down
12 changes: 12 additions & 0 deletions src/pages/code-playground/page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from "react";
import { GlobalLayout } from "../../components";
import CodePlayground from "../../components/activities/code-playground";
const CodePlaygroundPage = () => {
return (
<GlobalLayout>
<CodePlayground/>
</GlobalLayout>
);
};

export default CodePlaygroundPage;
2 changes: 2 additions & 0 deletions src/pages/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import CodingPage from "./activities/coding/page";
import RoboticsPage from "./activities/robotics/page";
import GameDevelopment from "./activities/game-development/page";
import ContactUsPage from "./contact-us/page";
import CodePlaygroundPage from "./code-playground/page";

export {
HomePage,
Expand All @@ -14,4 +15,5 @@ export {
RoboticsPage,
GameDevelopment,
ContactUsPage,
CodePlaygroundPage
};
1 change: 1 addition & 0 deletions src/utils/appData.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const navigationMenu = [
title: "Robotics",
url: "/activities/robotics",
},

],
},
{
Expand Down

0 comments on commit 57cddb1

Please sign in to comment.