Skip to content

done #93

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

done #93

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
66 changes: 65 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-router-dom": "^6.27.0"
},
"devDependencies": {
"@types/react": "^18.0.37",
Expand Down
63 changes: 45 additions & 18 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}

.logo {
/* .logo {
height: 6em;
padding: 1.5em;
will-change: filter;
Expand All @@ -16,27 +14,56 @@
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}

@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
} */

@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
.App {
min-width: 900px;
display: flex;
justify-content: center;
margin: 0 auto;
}

.card {
padding: 2em;
width: 200px;
}
.card img {
width: 100%;
}

.read-the-docs {
color: #888;
}
.info {
width: 100%;
display: flex;
flex-direction: column;
}
.company-card {
display: flex;
justify-content: space-between;
flex-direction: row;
width: 100%;
}
.company-card img {
width: 30%;
}
.tech-list {
display: flex;
justify-content: space-around;
}
.tech-details {
width: 200px;
height: 90px;
border: 1px solid black;
margin: 0 4px;
}
.tech-list p {
text-align: center;
}
.tech-details img {
width: 30%;
margin: 0 auto;
display: flex;
justify-content: center;
justify-items: center;
}
35 changes: 29 additions & 6 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
import "./App.css";
import { useState } from 'react'
import { Route, Routes } from 'react-router-dom'
import './App.css'
import companyList from './companies.json'
import technologyList from './technologies.json'
import Navbar from './components/Navbar'
import HomePage from './pages/HomePage'
import Companies from './pages/CompanyPage'
import Technologies from './pages/TechnologyPage'
function App () {
const [companies, setCompanies] = useState(companyList)
const [technologies, setTechnologies] = useState(technologyList)

function App() {
return (
<div className="App">
<h1>LAB | React Stack Tracker</h1>
<div className='App'>
<Navbar />
<Routes>
<Route path='/' element={<HomePage companies={companies} />} />
<Route
path='/company/:slug'
element={
<Companies companies={companies} technologies={technologies} />
}
/>
<Route
path='/tech/:slug'
element={<Technologies technologies={technologies} />}
/>
</Routes>
</div>
);
)
}

export default App;
export default App
6 changes: 3 additions & 3 deletions src/components/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function Navbar() {
return <nav>Navbar</nav>;
function Navbar () {
return <nav>StackTracker</nav>
}

export default Navbar;
export default Navbar
7 changes: 5 additions & 2 deletions src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.jsx'
import './index.css'
import { BrowserRouter } from 'react-router-dom'

ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>,
<BrowserRouter>
<App />
</BrowserRouter>
</React.StrictMode>
)
39 changes: 34 additions & 5 deletions src/pages/CompanyPage.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,38 @@
function CompanyPage() {
import React, { useState } from 'react'
import { useParams, Link } from 'react-router-dom'

function CompanyPage (props) {
const { slug } = useParams()

const companyInfo = props.companies.find(company => {
return company.slug === slug
})
const [techs, setTechs] = useState(props.technologies)
return (
<div>
<h1>CompanyPage</h1>
<div className='info'>
<h1>Company Profile</h1>
<div className=' company-card'>
<img src={companyInfo.logo} alt='' />
<div>
<p>{companyInfo.name}</p>

<p>{companyInfo.description}</p>
</div>
</div>
<div className='tech-list'>
{techs.map(tech => {
return (
<Link to={`/tech/${tech.slug}`} key={tech.id}>
<div className='tech-details'>
<img src={tech.image} alt='' />
</div>
<p>{tech.name}</p>
</Link>
)
})}
</div>
</div>
);
)
}

export default CompanyPage;
export default CompanyPage
20 changes: 16 additions & 4 deletions src/pages/HomePage.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
function HomePage() {
import { Link } from 'react-router-dom'

function HomePage (props) {
return (
<div>
<h1>HomePage</h1>
<h1>StackTracker: Discover Tech Stacks Used by Top Companies</h1>
{props.companies.map(company => {
return (
<Link to={`/company/${company.slug}`} key={company.id}>
<div className='card'>
<img src={company.logo} alt='' />
<p>{company.name}</p>
</div>
</Link>
)
})}
</div>
);
)
}

export default HomePage;
export default HomePage
23 changes: 19 additions & 4 deletions src/pages/TechnologyPage.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
function TechnologyPage() {
import { useParams, Link } from 'react-router-dom'
function TechnologyPage (props) {
const { slug } = useParams()
const techInfo = props.technologies.find(tech => {
return tech.slug === slug
})
console.log(techInfo)
return (
<div>
<h1>TechnologyPage</h1>
<h1>Technology Details</h1>
<div className=' company-card'>
<img src={techInfo.image} alt='' />
<div>
<p>{techInfo.name}</p>

<p>{techInfo.description}</p>
</div>
</div>
<button onClick={() => window.history.back()}>Back</button>
</div>
);
)
}

export default TechnologyPage;
export default TechnologyPage