lbry-desktop/src/ui/scss/component/_form-field.scss

340 lines
6.7 KiB
SCSS
Raw Normal View History

2019-02-13 17:27:20 +01:00
@import '~@lbry/components/sass/form/_index.scss';
2018-06-21 04:22:13 +02:00
// Reset lbry components style that turns buttons inside of forms black
form {
.button--primary,
[type='submit'] {
&:not(:hover),
&:hover {
@extend .button--primary;
}
}
2019-07-24 02:12:34 +02:00
.button--inverse {
&:not(:hover),
&:hover {
// @extend .button--inverse;
}
}
}
textarea {
&::placeholder {
opacity: 0.4;
}
}
// lbry/components overrides and minor styles
// Some items have very specific styling
// This is because many styles inside `lbry/components/sass/form/` are very specific
// As styles become hardened here, they _should_ slowly move over to that repo
2019-05-01 07:16:12 +02:00
input-submit {
align-items: center;
}
2019-02-13 17:27:20 +01:00
2019-02-18 18:24:56 +01:00
input[type='number'] {
width: 8em;
}
2019-07-21 23:31:22 +02:00
input,
2019-02-20 06:20:29 +01:00
input[type='text'],
input[type='number'],
2019-07-21 23:31:22 +02:00
input[type='email'],
select,
textarea {
2019-07-21 23:31:22 +02:00
height: var(--input-height);
padding-bottom: 0.1em;
2019-02-20 06:20:29 +01:00
[data-mode='dark'] & {
&::placeholder {
opacity: 0.4;
}
}
}
input,
select,
textarea {
border-color: lighten($lbry-black, 20%);
border-radius: var(--input-border-radius);
2019-09-26 18:07:11 +02:00
background-color: $lbry-white;
border-width: 1px;
}
2019-02-20 06:20:29 +01:00
fieldset-section {
2019-07-21 23:31:22 +02:00
margin-bottom: var(--spacing-small);
2019-02-20 06:20:29 +01:00
label {
width: auto;
text-transform: none;
2019-09-26 18:07:11 +02:00
color: lighten($lbry-black, 20%);
2019-02-20 06:20:29 +01:00
}
}
2019-02-18 18:24:56 +01:00
checkbox-element {
&[disabled='true'] {
opacity: 0.3;
}
}
2019-02-13 17:27:20 +01:00
checkbox-element,
radio-element,
fieldset:last-child,
fieldset-section:last-child {
margin-bottom: 0;
2017-06-15 21:30:56 +02:00
}
2017-04-10 14:32:40 +02:00
2019-02-18 18:24:56 +01:00
checkbox-element,
radio-element {
2019-08-27 16:43:42 +02:00
&:hover {
cursor: pointer !important;
}
2019-02-20 06:20:29 +01:00
label {
margin-bottom: 0;
2019-07-21 23:31:22 +02:00
margin-left: var(--spacing-miniscule);
2019-07-22 04:05:37 +02:00
font-size: var(--font-body);
2019-07-23 10:05:51 +02:00
[data-mode='dark'] & {
color: $lbry-gray-1;
&:hover {
color: $lbry-teal-4;
}
}
2019-07-21 23:31:22 +02:00
}
}
checkbox-toggle {
2019-08-27 16:43:42 +02:00
border-width: 1px;
border-radius: var(--input-border-radius);
2019-07-21 23:31:22 +02:00
&:before {
background-position: center;
background-repeat: no-repeat;
background-size: 100%;
transition: all 0.2s;
2019-02-20 06:20:29 +01:00
}
2019-02-18 18:24:56 +01:00
}
2019-02-20 06:20:29 +01:00
fieldset-group {
&.fieldset-group--smushed {
justify-content: flex-start;
2018-03-26 23:32:43 +02:00
2019-02-20 06:20:29 +01:00
fieldset-section {
width: auto;
margin-bottom: 0;
2019-08-19 18:10:48 +02:00
&:first-child {
input,
select {
2019-02-20 06:20:29 +01:00
border-right: none;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}
&:nth-of-type(2) {
input,
select {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
2019-02-20 06:20:29 +01:00
}
}
}
&.fieldgroup--paginate {
2019-06-11 20:10:58 +02:00
padding-bottom: var(--spacing-large);
margin-top: var(--spacing-large);
align-items: flex-end;
2019-02-20 06:20:29 +01:00
justify-content: center;
2019-02-13 17:27:20 +01:00
}
2017-10-15 00:37:40 +02:00
}
2019-02-20 06:20:29 +01:00
// This is a special case where the prefix appears "inside" the input
// It would be way simpler to just use position: absolute and give it a width
// but the width can change when we use it for the name prefix
// lbry:// {input}, lbry://@short {input}, @lbry://longername {input}
// The spacing/alignment isn't very robust and will probably need to be changed
// if we use this in more places
&.fieldset-group--disabled-prefix {
align-items: flex-end;
label {
min-height: 18px;
2019-08-27 16:43:42 +02:00
white-space: nowrap;
// Set width 0 and overflow visible so the label can act as if it's the input label and not a random text node in a side by side div
overflow: visible;
width: 0;
}
2019-02-20 06:20:29 +01:00
fieldset-section:first-child .form-field__prefix,
fieldset-section:last-child input {
border-color: $lbry-black;
[data-mode='dark'] {
border-color: $lbry-gray-4;
}
}
fieldset-section:first-child {
.form-field__prefix {
white-space: nowrap;
2019-07-21 23:31:22 +02:00
padding: var(--spacing-miniscule);
height: var(--input-height);
2019-02-20 06:20:29 +01:00
padding-right: 0;
border: 1px solid;
2019-09-26 18:07:11 +02:00
border-top-left-radius: var(--input-border-radius);
border-bottom-left-radius: var(--input-border-radius);
2019-02-20 06:20:29 +01:00
border-right: 0;
border-color: $lbry-black;
2019-02-20 06:20:29 +01:00
color: $lbry-gray-4;
2019-09-26 18:07:11 +02:00
background-color: $lbry-white;
[data-mode='dark'] & {
border-color: $lbry-gray-4;
}
2019-02-20 06:20:29 +01:00
}
}
fieldset-section:last-child {
width: 100%;
input {
border-left: 0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
2019-02-20 06:20:29 +01:00
padding-left: var(--spacing-xs);
&:focus {
border-image-slice: 1;
border-image-source: linear-gradient(to right, $lbry-black, $lbry-teal-5 5%);
}
2018-10-17 19:14:24 +02:00
2019-02-20 06:20:29 +01:00
[data-mode='dark'] & {
&:focus {
border-image-source: linear-gradient(to right, $lbry-gray-4, $lbry-teal-5 5%);
}
}
}
2018-10-17 19:14:24 +02:00
}
}
2017-04-10 14:32:40 +02:00
}
2017-04-09 17:06:23 +02:00
2019-02-13 17:27:20 +01:00
// form buttons are black by default
form {
[type='button'],
[type='submit'] {
2019-06-17 22:32:38 +02:00
&.button--inverse {
&:not(:hover) {
2019-06-17 22:32:38 +02:00
background-color: transparent;
border-color: $lbry-black;
color: $lbry-black;
}
&:hover {
2019-06-17 22:32:38 +02:00
background-color: $lbry-teal-4;
}
}
}
2017-04-09 17:06:23 +02:00
}
2019-02-13 17:27:20 +01:00
fieldset-section {
2019-02-20 06:20:29 +01:00
input-submit {
input {
&:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
2019-07-24 02:12:34 +02:00
border-right: none;
2019-02-20 06:20:29 +01:00
}
2019-02-13 17:27:20 +01:00
}
2018-06-13 07:20:53 +02:00
2019-06-17 22:32:38 +02:00
input[type='email'],
2019-05-01 07:16:12 +02:00
input[type='text'] {
[data-mode='dark'] & {
&:not(:focus) {
border-color: $lbry-gray-5;
}
}
}
.button,
// specificity needed because of @lbry/component rules
2019-07-23 10:05:51 +02:00
// @lbry/componentfixme
.button[type='submit']:not(:hover) {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
2019-07-21 23:31:22 +02:00
border-color: $lbry-black;
opacity: 1;
2019-07-24 02:12:34 +02:00
[data-mode='dark'] & {
border-color: $lbry-gray-5;
color: $lbry-white;
}
2019-02-13 17:27:20 +01:00
}
2018-06-13 07:20:53 +02:00
}
2018-10-17 19:14:24 +02:00
2019-02-13 17:27:20 +01:00
select {
max-width: 12em;
2019-07-21 23:31:22 +02:00
background-position: 95% center;
background-size: 1.2rem;
2019-02-13 17:27:20 +01:00
[data-mode='dark'] & {
background-color: transparent;
option {
background-color: $lbry-gray-5;
}
2019-02-13 17:27:20 +01:00
}
2018-10-17 19:14:24 +02:00
}
2019-02-20 06:20:29 +01:00
[data-mode='dark'] & {
input,
textarea,
select {
color: $lbry-white;
}
input:not(:focus):not(.form-field--copyable),
textarea:not(:focus),
select:not(:focus) {
2019-07-01 20:42:32 +02:00
border-color: var(--dm-color-04);
2019-02-20 06:20:29 +01:00
}
}
2017-04-09 17:06:23 +02:00
}
2019-02-13 17:27:20 +01:00
.form-field--copyable {
2019-07-21 23:31:22 +02:00
background-color: rgba($lbry-gray-1, 0.5);
2019-02-13 17:27:20 +01:00
border: 1px solid $lbry-gray-1;
color: $lbry-gray-5;
padding: 0.2rem 0.75rem;
text-overflow: ellipsis;
user-select: text;
2019-02-20 06:20:29 +01:00
cursor: default;
2019-02-13 17:27:20 +01:00
2019-06-29 00:21:21 +02:00
[data-mode='dark'] & {
2019-02-13 17:27:20 +01:00
background-color: rgba($lbry-white, 0.3);
border-color: $lbry-gray-5;
color: inherit;
}
2017-04-09 17:06:23 +02:00
}
2019-02-13 17:27:20 +01:00
.form-field__help {
@extend .help;
2019-07-21 23:31:22 +02:00
margin-top: var(--spacing-small);
margin-bottom: var(--spacing-large);
2019-01-09 05:29:06 +01:00
}
2019-09-26 18:07:11 +02:00
.form-field--short {
width: 25em;
}
2019-02-13 17:27:20 +01:00
.form-field--price-amount {
width: 7em;
2017-04-09 17:06:23 +02:00
}
2018-03-26 23:32:43 +02:00
2019-02-13 17:27:20 +01:00
.form-field--address {
width: 370px;
2018-05-25 06:36:43 +02:00
}