Make TextInput label real, add aria-label to icon buttons

This commit is contained in:
Ken-Håvard Lieng 2020-05-12 07:48:12 +02:00
parent 9581a63e81
commit 4b8491cf99
7 changed files with 124 additions and 97 deletions

File diff suppressed because one or more lines are too long

View File

@ -180,7 +180,7 @@ i[class*=' icon-']:before {
padding: 25px 15px 10px; padding: 25px 15px 10px;
} }
.textinput span { .textinput-label {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
@ -441,13 +441,17 @@ input::-webkit-inner-spin-button {
.connect-form-address label { .connect-form-address label {
margin-top: 5px; margin-top: 5px;
font: 12px 'Montserrat', sans-serif; font: 12px 'Montserrat', sans-serif;
padding: 10px; padding: 10px 0;
padding-bottom: 0; padding-bottom: 0;
text-align: center; text-align: center;
background: #fff; background: #fff;
color: #777; color: #777;
} }
.connect-form-ssl {
padding: 10px !important;
}
.connect-form-button-optionals { .connect-form-button-optionals {
font-size: 24px; font-size: 24px;
color: #999; color: #999;

View File

@ -114,9 +114,17 @@ export default class TabList extends PureComponent {
<div className={className}> <div className={className}>
<div className="tab-container">{tabs}</div> <div className="tab-container">{tabs}</div>
<div className="side-buttons"> <div className="side-buttons">
<Button icon={FiPlus} onClick={this.handleConnectClick} /> <Button
<Button icon={FiUser} /> icon={FiPlus}
<Button icon={FiSettings} onClick={this.handleSettingsClick} /> aria-label="Connect"
onClick={this.handleConnectClick}
/>
<Button icon={FiUser} aria-label="User" />
<Button
icon={FiSettings}
aria-label="Settings"
onClick={this.handleSettingsClick}
/>
</div> </div>
</div> </div>
); );

View File

@ -58,12 +58,23 @@ const ChatTitle = ({
{serverError} {serverError}
</div> </div>
{tab.name && ( {tab.name && (
<Button icon={FiSearch} title="Search" onClick={onToggleSearch} /> <Button
icon={FiSearch}
title="Search"
aria-label="Search"
onClick={onToggleSearch}
/>
)} )}
<Button icon={FiX} title={closeTitle} onClick={onCloseClick} /> <Button
icon={FiX}
title={closeTitle}
aria-label={closeTitle}
onClick={onCloseClick}
/>
<Button <Button
icon={FiUsers} icon={FiUsers}
className="button-userlist" className="button-userlist"
aria-label="Users"
onClick={onToggleUserList} onClick={onToggleUserList}
/> />
</div> </div>

View File

@ -108,6 +108,7 @@ class Connect extends Component {
noError noError
/> />
<Checkbox <Checkbox
classNameLabel="connect-form-ssl"
name="tls" name="tls"
label="SSL" label="SSL"
topLabel topLabel
@ -122,6 +123,7 @@ class Connect extends Component {
<Button <Button
className="connect-form-button-optionals" className="connect-form-button-optionals"
icon={FiMoreHorizontal} icon={FiMoreHorizontal}
aria-label="Show more"
onClick={this.handleShowClick} onClick={this.handleShowClick}
/> />
<Button type="submit">Connect</Button> <Button type="submit">Connect</Button>

View File

@ -1,9 +1,9 @@
import React from 'react'; import React from 'react';
import classnames from 'classnames'; import classnames from 'classnames';
const Checkbox = ({ name, label, topLabel, ...props }) => ( const Checkbox = ({ name, label, topLabel, classNameLabel, ...props }) => (
<label <label
className={classnames('checkbox', { className={classnames('checkbox', classNameLabel, {
'top-label': topLabel 'top-label': topLabel
})} })}
htmlFor={name} htmlFor={name}

View File

@ -58,6 +58,7 @@ export default class TextInput extends PureComponent {
className={field.value && 'value'} className={field.value && 'value'}
type="text" type="text"
name={name} name={name}
id={name}
autoCapitalize="off" autoCapitalize="off"
autoCorrect="off" autoCorrect="off"
autoComplete="off" autoComplete="off"
@ -100,16 +101,17 @@ export default class TextInput extends PureComponent {
} }
}} }}
/> />
<span <label
className={classnames('textinput-1', { htmlFor={name}
className={classnames('textinput-label', 'textinput-1', {
value: field.value, value: field.value,
error: form.touched[name] && form.errors[name] error: form.touched[name] && form.errors[name]
})} })}
> >
{label} {label}
</span> </label>
<span <span
className={classnames('textinput-2', { className={classnames('textinput-label', 'textinput-2', {
value: field.value, value: field.value,
error: form.touched[name] && form.errors[name] error: form.touched[name] && form.errors[name]
})} })}