-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added bugs updated css for the tables to work better on mobile
- Loading branch information
1 parent
fa82c0d
commit 3c9a272
Showing
11 changed files
with
10,288 additions
and
10,183 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.hideMobile { | ||
display: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from "react"; | ||
|
||
import { Table, Icon } from "semantic-ui-react"; | ||
import './BugTable.css' | ||
|
||
|
||
export default function BugTable({ bug }) { | ||
return ( | ||
<Table.Row key={bug.id} id={bug.id}> | ||
<Table.Cell><Icon name='check' /></Table.Cell> | ||
<Table.Cell> | ||
<img className="photo" src={`/imgs/${bug.img}`} alt={bug.bug_name} /> | ||
</Table.Cell> | ||
<Table.Cell>{bug.bug_name}</Table.Cell> | ||
<Table.Cell className="hideMobile">{bug.price}</Table.Cell> | ||
<Table.Cell>{bug.location}</Table.Cell> | ||
<Table.Cell collapsing className="hideMobile">{bug.time}</Table.Cell> | ||
</Table.Row> | ||
) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import React, { useState, useEffect } from "react"; | ||
|
||
import { Table, Container } from "semantic-ui-react"; | ||
import BugTable from '../../components/BugTable/BugTable' | ||
import Loading from '../../components/Loader/Loader' | ||
import BugData from '../../Data/bugData' | ||
|
||
export default function Bug({ currentHemisphere }) { | ||
console.log(BugData, "data") | ||
const [currentBug, setCurrentBug] = useState(); | ||
const [loading, setLoading] = useState(true); | ||
async function getData() { | ||
var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; | ||
const today = new Date(); | ||
const currentHour = `h_${today.getHours()}`; | ||
console.log(currentHour) | ||
const currentMonth = months[today.getMonth()]; | ||
console.log(currentMonth, "month") | ||
let filterBug = await BugData.filter(function (i) { | ||
return i.time_available[currentHour] === true && | ||
i.hemisphere[currentHemisphere][currentMonth] === true; | ||
}); | ||
console.log(filterBug, "filteredbug") | ||
setCurrentBug(filterBug); | ||
setLoading(() => false); | ||
} | ||
console.log(currentBug, "bug page") | ||
// const allBug = currentBug.map((m, i) => <BugTable key={m.id} {...m} />) | ||
|
||
useEffect(() => { | ||
getData(); | ||
}, [currentHemisphere]); | ||
|
||
if (loading) { | ||
return ( | ||
<> | ||
<Loading /> | ||
</> | ||
); | ||
} | ||
return ( | ||
<Container style={{ maxWidth: 800 }}> | ||
<Table basic striped unstackable> | ||
<Table.Header> | ||
<Table.Row> | ||
<Table.HeaderCell>Caught</Table.HeaderCell> | ||
<Table.HeaderCell></Table.HeaderCell> | ||
<Table.HeaderCell>Name</Table.HeaderCell> | ||
<Table.HeaderCell className="mobile hidden">Price</Table.HeaderCell> | ||
<Table.HeaderCell>Location</Table.HeaderCell> | ||
<Table.HeaderCell className="mobile hidden">Avaliable</Table.HeaderCell> | ||
</Table.Row> | ||
</Table.Header> | ||
<Table.Body> | ||
{currentBug.map((bug) => { | ||
return ( | ||
<BugTable bug={bug} /> | ||
); | ||
})} | ||
</Table.Body> | ||
</Table> | ||
</Container> | ||
) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters