Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zakaria Chowdhury Friday 6:30 PM #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
body {
display: flex;
justify-content: center;
height: 100vh;
margin: 0;
}

.square-container {
display: flex;
justify-content: center;
gap: 10px;
margin-bottom: 20px;
}

.square {
width: 50px;
height: 50px;
color: white;
display: flex;
align-items: center;
justify-content: center;
}
12 changes: 12 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import SquareSet from './SquareSet';

function App() {
return (
<div className="App">
<SquareSet />
</div>
);
}

export default App;
33 changes: 33 additions & 0 deletions src/SquareSet.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React, { useState } from 'react';
import './App.css';

const SquareSet = () => {
const [activeIndex, setActiveIndex] = useState(0);

const squares = Array.from({ length: 5 }); // Create an array for 5 squares

const handleToggle = () => {
setActiveIndex((prevIndex) => (prevIndex + 1) % squares.length);
};

return (
<div>
<div className="square-container">
{squares.map((_, index) => (
<div
key={index}
className="square"
style={{
backgroundColor: index === activeIndex ? 'red' : 'black',
}}
>
Square {index + 1}
</div>
))}
</div>
<button onClick={handleToggle}>Next Square</button>
</div>
);
};

export default SquareSet;
75 changes: 59 additions & 16 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,25 +1,68 @@
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;

color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;

font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}

body {
margin: 0;
padding: 0;
font-family: sans-serif;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}

.boards {
margin: 20px 0;
overflow: hidden;
h1 {
font-size: 3.2em;
line-height: 1.1;
}

.board {
border: 5px solid #ccc;
float: left;
font:
700 24px HelveticaNeue,
Helvetica,
Arial;
margin-right: 20px;
padding: 20px;
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}

.board.selected {
border-color: #3ba8aa;
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}
19 changes: 9 additions & 10 deletions src/main.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from "react";
import ReactDOM from "react-dom/client";
import BoardSwitcher from "./components/BoardSwitcher";
import "./index.css";
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import App from './App.jsx'
import './index.css'

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
<React.StrictMode>
<BoardSwitcher numBoards={3} />
</React.StrictMode>
);
createRoot(document.getElementById('root')).render(
<StrictMode>
<App />
</StrictMode>,
)