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

sidebar UI fixed #59

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
7 changes: 2 additions & 5 deletions packages/app/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import App, { Container } from 'next/app';
import { Container as UIContainer } from 'semantic-ui-react'
import React from 'react';
import withApolloClient from '../lib/with-apollo';
import { ApolloProvider } from 'react-apollo';
Expand All @@ -10,16 +9,14 @@ class MyApp extends App {
render () {
const { Component, pageProps, apolloClient } = this.props
return (
<div>
<div className="base">
<Head>
<link rel='stylesheet' href='/_next/static/style.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/instantsearch.css@7.0.0/themes/algolia-min.css' />
</Head>
<ApolloProvider client={apolloClient}>
<Container>
<UIContainer>
<Component {...pageProps} />
</UIContainer>
<Component {...pageProps} />
</Container>
</ApolloProvider>
</div>
Expand Down
30 changes: 16 additions & 14 deletions packages/app/pages/tides.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import React from 'react'
import React from 'react';
import { connectHits } from 'react-instantsearch-dom';
import SpotLink from '../ui/components/SpotLink';
import SearchLayout from '../ui/layouts/SearchLayout'
import { Grid } from 'semantic-ui-react'
import SearchLayout from '../ui/layouts/SearchLayout';
import { Grid, Container } from 'semantic-ui-react';

const CustomHits = connectHits(({ hits }) => (
<Grid columns={1}>
<Grid.Row>
{hits.map(hit =>
<Grid.Column key={hit.objectID} mobile={16} tablet={8} computer={4}>
<div className="ais-Hits-item">
<SpotLink spot={Object.assign({}, hit, { id: hit.objectID })} />
</div>
</Grid.Column>
)}
</Grid.Row>
</Grid>
<Container>
<Grid columns={1}>
<Grid.Row>
{hits.map(hit =>
<Grid.Column key={hit.objectID} mobile={16} tablet={8} computer={4}>
<div className="ais-Hits-item">
<SpotLink spot={Object.assign({}, hit, { id: hit.objectID })} />
</div>
</Grid.Column>
)}
</Grid.Row>
</Grid>
</Container>
))

export default function SearchPage() {
Expand Down
20 changes: 13 additions & 7 deletions packages/app/ui/components/AlgoliaSearchBox.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { SearchBox } from 'react-instantsearch/dom';
import { Icon } from 'semantic-ui-react'
import { Icon, Container, Grid } from 'semantic-ui-react'

export default class AlgoliaSearchBox extends Component {
render() {
const { handleButtonClick } = this.props;
return (
<div className="searchBoxWrap">
<SearchBox className="ui input fluid large" />
<div className="sidebarButton">
<Icon color='grey' link name='bars' onClick={handleButtonClick} />
</div>
</div>
<Container>
<Grid.Row columns={1}>
<Grid.Column>
<div className="searchBoxWrap">
<SearchBox className="ui input fluid large" />
<div className="sidebarButton">
<Icon color='grey' link name='bars' onClick={handleButtonClick} />
</div>
</div>
</Grid.Column>
</Grid.Row>
</Container>
);
}
}
Expand Down
42 changes: 22 additions & 20 deletions packages/app/ui/components/InputSearchBox.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Divider, Icon, Input, Grid } from 'semantic-ui-react';
import { Divider, Icon, Input, Grid, Container } from 'semantic-ui-react';
import Router from 'next/router';

const navigateToSearchPage = (query) =>
Expand Down Expand Up @@ -35,26 +35,28 @@ export default class InputSearchBox extends Component {
render() {
const { handleButtonClick } = this.props;
return (
<Grid.Row>
<Grid.Column>
<Divider hidden />
<div className="searchBoxWrap">
<Input
onKeyDown={this.handleKeyDown}
onChange={this.handleChange}
type='search'
icon='search'
size='large'
fluid
placeholder='Search...'
value={this.state.query}
/>
<div className="sidebarButton">
<Icon color='grey' link name='bars' onClick={handleButtonClick} />
<Container>
<Grid.Row columns={1}>
<Grid.Column>
<Divider hidden />
<div className="searchBoxWrap">
<Input
onKeyDown={this.handleKeyDown}
onChange={this.handleChange}
type='search'
icon='search'
size='large'
fluid
placeholder='Search...'
value={this.state.query}
/>
<div className="sidebarButton">
<Icon color='grey' link name='bars' onClick={handleButtonClick} />
</div>
</div>
</div>
</Grid.Column>
</Grid.Row>
</Grid.Column>
</Grid.Row>
</Container>
);
}
}
Expand Down
4 changes: 0 additions & 4 deletions packages/app/ui/components/SideBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ export default class SideBar extends Component {
<Icon name='tint' />
Tides
</Menu.Item>
<Menu.Item as='a' href='/search'>
<Icon name='search' />
Search
</Menu.Item>
<Menu.Item as='a' onClick={this.handleButtonClick}>
<Icon name='close' />
Close
Expand Down
13 changes: 11 additions & 2 deletions packages/app/ui/containers/Spot.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react';
import React from 'react'
import PropTypes from 'prop-types'
import { Query } from 'react-apollo'
import gql from 'graphql-tag'
import Head from 'next/head'
import Tides from './Tides'
import AppLayout from '../layouts/App'
import { Grid, Container } from 'semantic-ui-react'

export const getSpotById = gql`
query getSpotById($id: ID!) {
Expand Down Expand Up @@ -38,7 +39,15 @@ export default function Spot ({ id }) {
<meta name="description" content={`${spot.city} tide timetables and charts for the next 10 days`} key="description" />
<meta name="keywords" content={`${spot.city} tide times,${spot.city} high tide,${spot.city} tide chart,${spot.city} tide tables,${spot.city} low tide`} key="keywords" />
</Head>
<Tides spot={spot} />
<Container>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we should only have Semantic container on the top level of the app - not sprinkled around the codebase

<Grid columns={1}>
<Grid.Row>
<Grid.Column>
<Tides spot={spot} />
</Grid.Column>
</Grid.Row>
</Grid>
</Container>
</AppLayout>
) : null;
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ html, body {
height: 100%;
}

#__next, .layoutWrap {
#__next, .layoutWrap, .base {
height: 100%;
}

Expand Down