mirror of
https://github.com/fergalmoran/turnstone.git
synced 2025-12-22 09:49:56 +00:00
Only show a transparent background on input box if there is no typeahead
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
### 1.1.2 (13 Mar 2022)
|
### 1.1.2 (Unreleased)
|
||||||
|
|
||||||
|
- Add screengrab GIF to README
|
||||||
- Add Turnstone logo to README
|
- Add Turnstone logo to README
|
||||||
- Add Turnstone screengrab gif to README
|
|
||||||
|
|
||||||
### 1.1.1 (12 Mar 2022)
|
### 1.1.1 (12 Mar 2022)
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.query,
|
.input {
|
||||||
.typeahead {
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 2.5em;
|
height: 2.5em;
|
||||||
@@ -42,10 +41,10 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
outline: none;
|
outline: none;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.containerFocus .query,
|
.containerFocus .input {
|
||||||
.containerFocus .typeahead {
|
|
||||||
border-top: none;
|
border-top: none;
|
||||||
border-left: none;
|
border-left: none;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
@@ -54,14 +53,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 640px) {
|
@media (min-width: 640px) {
|
||||||
.query,
|
.input {
|
||||||
.typeahead {
|
|
||||||
width: 500px;
|
width: 500px;
|
||||||
font-size: 1.4em;
|
font-size: 1.4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.containerFocus .query,
|
.containerFocus .input {
|
||||||
.containerFocus .typeahead {
|
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
padding: 0 1.5em 0 .5em;
|
padding: 0 1.5em 0 .5em;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ body {
|
|||||||
sans-serif;
|
sans-serif;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
background: #f0f0f0;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
|
|||||||
@@ -24,9 +24,7 @@ exports[`Container > Component renders correctly 1`] = `
|
|||||||
spellCheck="false"
|
spellCheck="false"
|
||||||
style={
|
style={
|
||||||
{
|
{
|
||||||
"backgroundColor": "transparent",
|
|
||||||
"position": "relative",
|
"position": "relative",
|
||||||
"zIndex": 1,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
type="text"
|
type="text"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useDebounce } from 'use-debounce'
|
|||||||
import useData from './hooks/useData'
|
import useData from './hooks/useData'
|
||||||
import undef from '../utils/undef'
|
import undef from '../utils/undef'
|
||||||
import isUndefined from '../utils/isUndefined'
|
import isUndefined from '../utils/isUndefined'
|
||||||
import defaultStyles from './styles/input.styles.js'
|
import defaultStyles from './styles/container.styles.js'
|
||||||
import {
|
import {
|
||||||
useItemsState,
|
useItemsState,
|
||||||
useItemsError,
|
useItemsError,
|
||||||
@@ -90,6 +90,7 @@ export default function Container(props) {
|
|||||||
: defaultStyles[containerClassname]
|
: defaultStyles[containerClassname]
|
||||||
const inputClassName = hasFocus ? 'inputFocus' : 'input'
|
const inputClassName = hasFocus ? 'inputFocus' : 'input'
|
||||||
const inputStyles = customStyles[inputClassName] || customStyles.input
|
const inputStyles = customStyles[inputClassName] || customStyles.input
|
||||||
|
const queryDefaultStyle = hasTypeahead ? defaultStyles.query : defaultStyles.queryNoTypeahead
|
||||||
|
|
||||||
// Checks whether or not SWR data is to be treated as immutable
|
// Checks whether or not SWR data is to be treated as immutable
|
||||||
const isImmutable = (() => {
|
const isImmutable = (() => {
|
||||||
@@ -225,7 +226,7 @@ export default function Container(props) {
|
|||||||
id={id}
|
id={id}
|
||||||
name={name}
|
name={name}
|
||||||
className={`${inputStyles || ''} ${customStyles.query || ''}`.trim()}
|
className={`${inputStyles || ''} ${customStyles.query || ''}`.trim()}
|
||||||
style={defaultStyles.query}
|
style={queryDefaultStyle}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
type='text'
|
type='text'
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ const styles = {
|
|||||||
zIndex: 1,
|
zIndex: 1,
|
||||||
backgroundColor: 'transparent'
|
backgroundColor: 'transparent'
|
||||||
},
|
},
|
||||||
|
queryNoTypeahead: {
|
||||||
|
position: 'relative'
|
||||||
|
},
|
||||||
typeahead: {
|
typeahead: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
zIndex: 0,
|
zIndex: 0,
|
||||||
Reference in New Issue
Block a user