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

Improved tablet view! Looks pretty good on Safari and Chrome #531

Open
wants to merge 1 commit into
base: master
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
2 changes: 1 addition & 1 deletion src/client/src/components/DormButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const DormButtonWrapper = styled.div`
margin-bottom: 10px;
object-fit: cover;

@media only screen and (max-width: 768px) {
@media only screen and (max-width: 767px) {
max-width: 100%;
min-width: 100%;
max-height: 25vw;
Expand Down
4 changes: 2 additions & 2 deletions src/client/src/components/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ let MenuBtn = styled.input`
let MenuIcon = styled.label`
cursor: pointer;
margin-left: auto;
padding: 28px 10%;
padding: 28px 5vw;
user-select: none;
`

Expand Down Expand Up @@ -294,7 +294,7 @@ export default class NavBar extends Component {
}

render() {
const isMobile = this.state.width <= 700;
const isMobile = this.state.width <= 825;
const desktopMenu = (
<React.Fragment>
<MenuContainer>
Expand Down
42 changes: 36 additions & 6 deletions src/client/src/containers/Explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const SideBar = styled.div`
overflow-y: scroll;
min-height: 200px;
@media only screen and (min-width: 768px) {
width: 60%;
width: 65%;
padding: 0 0% 0% 0%;
min-height: 100vh;
z-index: 1;
Expand All @@ -39,7 +39,7 @@ width: 0%;
position: fixed;
padding-left: 0em;
float: right;
width: 40%;
width: 35%;
right: 0;
top: 0;
z-index:1;
Expand Down Expand Up @@ -138,8 +138,11 @@ export default class Explore extends Component {
super(props);
this.state = {
payload: _.clone(initialPayload),
dorms: []
dorms: [],
height: window.innerHeight,
width: window.innerWidth
};
this.handleWindowSizeChange = this.handleWindowSizeChange.bind(this);
this.updatePayload = this.updatePayload.bind(this)
this.resetPayload = this.resetPayload.bind(this)
}
Expand All @@ -148,6 +151,15 @@ export default class Explore extends Component {
window.scrollTo(0, 0)
document.title = "The Shaft";
this.fetchDorms();
window.addEventListener("resize", this.handleWindowSizeChange);
}

componentWillUnmount() {
window.removeEventListener("resize", this.handleWindowSizeChange);
}

handleWindowSizeChange() {
this.setState({ height: window.innerHeight, width: window.innerWidth });
}

preloadImages(dorms, callback){
Expand Down Expand Up @@ -202,7 +214,8 @@ export default class Explore extends Component {
}

render() {
return (
const isMobile = this.state.width <= 925;
const desktopMenu = (
<ExploreContainer>
<ScrollToTop>
<ColOne>
Expand All @@ -223,12 +236,29 @@ export default class Explore extends Component {
centerLatitude={40.808601}
centerLongitude={-73.966095}
width={"100%"}
height={"900px"}
height={this.state.height}
/>
</MapView>
</ColTwo>
</ScrollToTop>
</ExploreContainer>
</ExploreContainer>
)

const mobileMenu = (
<ExploreContainer>
<ScrollToTop>
<FilterSearchBG>
<SearchBar handleChange={this.updatePayload}/>
<Filters handleChange={this.updatePayload} payload={this.state.payload} reset={this.resetPayload} filterElements={filterElements}></Filters>
</FilterSearchBG>
<ExploreSidebar dorms={this.state.dorms}/>
</ScrollToTop>
</ExploreContainer>
)
return (
<div>
{isMobile ? mobileMenu : desktopMenu}
</div>
);
}
}