fix: input + label alignment

This commit is contained in:
Sean Yesmunt 2019-01-08 23:29:06 -05:00
parent b67eeeaa68
commit 9658cefa55
7 changed files with 62 additions and 50 deletions

View file

@ -63,7 +63,7 @@ class FileSelector extends React.PureComponent<Props> {
type === 'file' ? fileLabel || __('Choose File') : directoryLabel || __('Choose Directory');
return (
<FormRow verticallyCentered padded>
<FormRow>
<Button button="primary" onClick={() => this.handleButtonClick()} label={label} />
<input
webkitdirectory="true"

View file

@ -95,7 +95,7 @@ class UserPhoneNew extends React.PureComponent<Props, State> {
</p>
</header>
<Form onSubmit={this.handleSubmit}>
<FormRow padded verticallyCentered>
<FormRow padded>
<FormField type="select" name="country-codes" onChange={this.handleSelect}>
{countryCodes.map(country => (
<option key={country.countryCallingCode} value={country.countryCallingCode}>

View file

@ -73,7 +73,7 @@ class WalletSend extends React.PureComponent<Props> {
}
/>
</FormRow>
<FormRow padded>
<FormRow>
<FormField
type="text"
name="address"

View file

@ -2,7 +2,7 @@
import * as ICONS from 'constants/icons';
import * as SETTINGS from 'constants/settings';
import * as React from 'react';
import { FormField, FormFieldPrice } from 'component/common/form';
import { FormField, FormFieldPrice, FormRow } from 'component/common/form';
import Button from 'component/button';
import Page from 'component/page';
import FileSelector from 'component/common/file-selector';
@ -287,32 +287,38 @@ class SettingsPage extends React.PureComponent<Props, State> {
</header>
<div className="card__content">
<FormField
type="checkbox"
name="autoplay"
onChange={this.onAutoplayChange}
checked={autoplay}
postfix={__('Autoplay media files')}
/>
<FormRow>
<FormField
type="checkbox"
name="autoplay"
onChange={this.onAutoplayChange}
checked={autoplay}
postfix={__('Autoplay media files')}
/>
</FormRow>
<FormField
type="checkbox"
name="auto_download"
onChange={this.onAutoDownloadChange}
checked={autoDownload}
postfix={__('Automatically download new content from your subscriptions')}
/>
<FormRow>
<FormField
type="checkbox"
name="auto_download"
onChange={this.onAutoDownloadChange}
checked={autoDownload}
postfix={__('Automatically download new content from your subscriptions')}
/>
</FormRow>
<FormField
type="checkbox"
name="show_nsfw"
onChange={this.onShowNsfwChange}
checked={showNsfw}
postfix={__('Show NSFW content')}
helper={__(
'NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. '
)}
/>
<FormRow>
<FormField
type="checkbox"
name="show_nsfw"
onChange={this.onShowNsfwChange}
checked={showNsfw}
postfix={__('Show NSFW content')}
helper={__(
'NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. '
)}
/>
</FormRow>
</div>
</section>
@ -359,19 +365,21 @@ class SettingsPage extends React.PureComponent<Props, State> {
</header>
<div className="card__content">
<FormField
name="theme_select"
type="select"
onChange={this.onThemeChange}
value={currentTheme}
disabled={automaticDarkModeEnabled}
>
{themes.map(theme => (
<option key={theme} value={theme}>
{theme}
</option>
))}
</FormField>
<FormRow>
<FormField
name="theme_select"
type="select"
onChange={this.onThemeChange}
value={currentTheme}
disabled={automaticDarkModeEnabled}
>
{themes.map(theme => (
<option key={theme} value={theme}>
{theme}
</option>
))}
</FormField>
</FormRow>
<FormField
type="checkbox"

View file

@ -93,7 +93,7 @@
position: relative;
+ .card__content {
padding-top: var(--spacing-vertical-medium);
margin-top: var(--spacing-vertical-medium);
}
&:not(.card__header--flat) {

View file

@ -1,8 +1,4 @@
.form-field {
&:not(:last-of-type) {
margin-bottom: var(--spacing-vertical-small);
}
&.form-field--disabled {
opacity: 0.4;
pointer-events: none;
@ -91,6 +87,12 @@
padding-left: var(--spacing-vertical-small);
}
// Keeps radio buttons aligned with the labels
// This can probably be done in a better way, but after setting align-items: center on the parent, the label is still off a bit.
input[type='radio'] + .form-field__postfix {
padding-top: 3px;
}
.form-field__select-wrapper {
position: relative;
width: 20rem;

View file

@ -1,9 +1,10 @@
.form-row {
display: flex;
flex-direction: row;
align-items: flex-end;
&:not(&--vertically-centered) {
align-items: flex-end;
&:not(.form-row--padded):not(:last-of-type) {
margin-bottom: var(--spacing-vertical-medium);
}
.form-field {
@ -32,8 +33,9 @@
}
.form-row--padded {
padding-top: var(--spacing-vertical-medium);
padding-bottom: var(--spacing-vertical-medium);
// Ignore the class name, margin allows these to collapse with other items
margin-top: var(--spacing-vertical-large);
margin-bottom: var(--spacing-vertical-large);
}
.form-row--right {