Skip to content

modify language button display location #4

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 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 25 additions & 0 deletions src/components/YepsNavBar.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,31 @@
border-color: transparent;
}

.test-language-button {
position: relative;
float: right!important;
margin-top: 8px;
Copy link
Owner

Choose a reason for hiding this comment

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

Let's not hard code pixels on margin either. Maybe at least use percentage. Ideally, I think there may be some out-of-the-box solution from react-bootstrap.

margin-right: 15px;
margin-bottom: 5px;
background-color: transparent;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
@media (min-width: 768px) {
Copy link
Owner

Choose a reason for hiding this comment

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

Where is 768px from? Most mobile device has width of 480px or lower. Also hardcoding pixel is not responsive design.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Get this value from chrome inspect

Copy link
Owner

@jsy1218-zz jsy1218-zz Oct 29, 2018

Choose a reason for hiding this comment

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

Let's not hard code. I can think of two ways: 1) detect the device type 2) use the DOM object to get its current dev width.

.test-language-button {
display: none;
}
}

.test-language-button-in-collapse {
}
@media (max-width: 768px) {
.test-language-button-in-collapse {
display: none;
}
}

.language-button {
color: #000000;
background-color: transparent;
Expand Down
5 changes: 3 additions & 2 deletions src/components/YepsNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default class YepsNavBar extends React.Component<Props, State> {
render() {
let logo = require('../images/logo.png');
let collapsedMenu = this.state.isExpanded ? 'collapsed-menu' : '';
let languageButton = this.state.isExpanded ? 'collapsed-menu' : '';

return (
<div className={'navbar-default'}>
Expand All @@ -31,10 +30,12 @@ export default class YepsNavBar extends React.Component<Props, State> {
<img className={'logo-wrapper'} src={logo} alt="logo"/>
</Navbar.Brand>
<Navbar.Toggle onClick={this.expandCollapse}/>
<Button className={'language-button, test-language-button'} type="submit">Language</Button>
Copy link
Owner

Choose a reason for hiding this comment

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

You may be able to achieve ideal button positioning by using Narbar.Form with pullLeft, just like below. Also, latter on we will need to unilaterally deal with the form submit with some state transition, in maybe redux store. Let me know if there's any difficulty wrapping button around in the Navbar.Form

</Navbar.Header>

<Navbar.Collapse>
<Nav pullRight className={collapsedMenu}>
<Navbar.Form pullLeft className={languageButton}>
<Navbar.Form pullLeft className={'test-language-button-in-collapse'} >
<Button className={'language-button'} type="submit">Language</Button>
</Navbar.Form>
<NavItem eventKey={1} href="#">
Expand Down