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

[docs] Add placeholder for search bar #12296

Merged
merged 3 commits into from
Jul 27, 2018
Merged
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 .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = [
name: 'The main bundle of the docs',
webpack: false,
path: getMainFile().path,
limit: '176 KB',
limit: '179 KB',
},
{
name: 'The home page of the docs',
Expand Down
35 changes: 16 additions & 19 deletions docs/src/modules/components/AppSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import EventListener from 'react-event-listener';
import PropTypes from 'prop-types';
import Router from 'next/router';
import withWidth, { isWidthUp } from '@material-ui/core/withWidth';
import Input from '@material-ui/core/Input';
import SearchIcon from '@material-ui/icons/Search';
import { fade } from '@material-ui/core/styles/colorManipulator';
import { withStyles } from '@material-ui/core/styles';
Expand Down Expand Up @@ -117,11 +118,11 @@ const styles = theme => ({
'&:hover': {
background: fade(theme.palette.common.white, 0.25),
},
'& $input': {
'& $inputInput': {
transition: theme.transitions.create('width'),
width: 200,
width: 120,
'&:focus': {
width: 250,
width: 170,
},
},
},
Expand All @@ -134,21 +135,12 @@ const styles = theme => ({
alignItems: 'center',
justifyContent: 'center',
},
input: {
font: 'inherit',
inputRoot: {
color: 'inherit',
},
inputInput: {
padding: `${theme.spacing.unit}px ${theme.spacing.unit}px ${theme.spacing.unit}px ${theme
.spacing.unit * 9}px`,
border: 0,
display: 'block',
verticalAlign: 'middle',
whiteSpace: 'normal',
background: 'none',
margin: 0, // Reset for Safari
color: 'inherit',
width: '100%',
'&:focus': {
outline: 0,
},
},
});

Expand Down Expand Up @@ -179,12 +171,17 @@ class AppSearch extends React.Component {
<div className={classes.search}>
<SearchIcon />
</div>
<input
<Input
disableUnderline
placeholder="Search…"
id="docsearch-input"
ref={ref => {
inputRef={ref => {
this.inputRef = ref;
}}
className={classes.input}
classes={{
root: classes.inputRoot,
input: classes.inputInput,
}}
/>
</div>
);
Expand Down