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

289 lines
5.6 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
2019-02-13 17:27:20 +01:00
// lbry/components overrides and minor styles
2019-05-01 07:16:12 +02:00
// 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
input,
textarea,
select {
border-radius: var(--input-border-radius);
}
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-02-20 06:20:29 +01:00
input[type='text'],
input[type='number'],
select {
padding-bottom: 0.1em;
2019-02-20 06:20:29 +01:00
[data-mode='dark'] & {
&::placeholder {
opacity: 0.4;
}
}
}
fieldset-section {
label {
width: auto;
text-transform: none;
}
checkbox-element,
radio-element {
label {
font-size: medium;
}
}
}
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 {
input[type='checkbox']:checked + label {
color: $lbry-black;
[data-mode='dark'] & {
color: $lbry-white;
&:hover {
color: $lbry-teal-4;
}
}
}
2019-02-20 06:20:29 +01:00
label {
margin-bottom: 0;
}
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-02-20 06:20:29 +01:00
&:first-of-type {
input {
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-05-07 04:35:04 +02:00
margin: var(--spacing-vertical-large) 0;
2019-02-20 06:20:29 +01:00
align-items: center;
justify-content: center;
.pagination {
margin-bottom: -1em;
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-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-03-21 18:24:47 +01:00
padding: 0.2rem var(--spacing-s);
2019-02-20 06:20:29 +01:00
padding-right: 0;
border: 1px solid;
border-right: 0;
border-color: $lbry-black;
2019-02-20 06:20:29 +01:00
color: $lbry-gray-4;
[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'] {
&.button--primary {
&:not(:hover) {
background-color: $lbry-teal-5;
border-color: $lbry-teal-5;
}
&:hover {
background-color: $lbry-teal-3;
border-color: $lbry-teal-3;
}
}
}
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 {
2019-02-20 06:20:29 +01:00
border-right-color: transparent;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
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-05-01 07:16:12 +02:00
// input-submit is connected to a button
// The input height needs to match the button height to lineup correctly
// Other inputs are fine since they are on their own and are used under different circumstances
input[type='text'] {
height: var(--button-height);
[data-mode='dark'] & {
&:not(:focus) {
border-color: $lbry-gray-5;
}
}
}
.button {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-top-right-radius: var(--input-border-radius);
border-bottom-right-radius: var(--input-border-radius);
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;
background-color: $lbry-white;
[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) {
border-color: $lbry-gray-4;
}
}
2017-04-09 17:06:23 +02:00
}
2019-02-13 17:27:20 +01:00
.form-field--copyable {
background-color: rgba($lbry-gray-1, 0.3);
border: 1px solid $lbry-gray-1;
color: $lbry-gray-5;
flex: 1;
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
html[data-mode='dark'] & {
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
label + .react-toggle,
.react-toggle + label {
margin-left: var(--spacing-vertical-small);
}
2019-02-13 17:27:20 +01:00
.form-field__help {
@extend .help;
2019-02-20 06:20:29 +01:00
margin-top: var(--spacing-vertical-medium);
2019-01-09 05:29:06 +01:00
}
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
}