Improve styles of fancy components

This commit is contained in:
Andrew Kingston 2023-01-20 08:54:17 +00:00
parent 89e4b8b86e
commit 0489f9243d
8 changed files with 24 additions and 5 deletions

View File

@ -88,6 +88,7 @@
} }
.is-selected:not(.spectrum-ActionButton--emphasized) { .is-selected:not(.spectrum-ActionButton--emphasized) {
background: var(--spectrum-global-color-gray-300); background: var(--spectrum-global-color-gray-300);
border-color: var(--spectrum-global-color-gray-700);
} }
.noPadding { .noPadding {
padding: 0; padding: 0;

View File

@ -33,7 +33,7 @@
} }
</script> </script>
<FancyField {error} {value} {validate} {disabled}> <FancyField {error} {value} {validate} {disabled} autoHeight>
{#if label} {#if label}
<FancyFieldLabel placeholder={false}>{label}</FancyFieldLabel> <FancyFieldLabel placeholder={false}>{label}</FancyFieldLabel>
{/if} {/if}
@ -42,7 +42,6 @@
{#each options as option} {#each options as option}
<ActionButton <ActionButton
selected={getOptionValue(option) === value} selected={getOptionValue(option) === value}
size="S"
on:click={() => onChange(getOptionValue(option))} on:click={() => onChange(getOptionValue(option))}
> >
{getOptionLabel(option)} {getOptionLabel(option)}
@ -53,11 +52,18 @@
<style> <style>
.options { .options {
margin-top: 22px; margin-top: 34px;
margin-bottom: 14px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
gap: 6px; gap: 6px;
} }
.options :global(.spectrum-ActionButton) {
font-size: 15px;
line-height: 17px;
height: auto;
padding: 6px 10px;
}
</style> </style>

View File

@ -39,6 +39,7 @@
} }
.text { .text {
font-size: 15px; font-size: 15px;
line-height: 17px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;

View File

@ -10,6 +10,7 @@
export let validate export let validate
export let value export let value
export let ref export let ref
export let autoHeight
const formContext = getContext("fancy-form") const formContext = getContext("fancy-form")
const id = Math.random() const id = Math.random()
@ -41,6 +42,7 @@
class:disabled class:disabled
class:focused class:focused
class:clickable class:clickable
class:auto-height={autoHeight}
> >
<div class="content" on:click> <div class="content" on:click>
<div class="field"> <div class="field">
@ -94,6 +96,9 @@
height: 64px; height: 64px;
padding: 0 16px; padding: 0 16px;
} }
.fancy-field.auto-height .content {
height: auto;
}
.content, .content,
.field { .field {
display: flex; display: flex;

View File

@ -9,6 +9,7 @@
<style> <style>
div { div {
font-size: 14px; font-size: 14px;
line-height: 15px;
font-weight: 500; font-weight: 500;
position: absolute; position: absolute;
top: 10px; top: 10px;

View File

@ -47,6 +47,8 @@
transform: translateY(9px); transform: translateY(9px);
background: transparent; background: transparent;
font-size: 15px; font-size: 15px;
line-height: 17px;
font-family: var(--font-sans);
color: var(--spectrum-global-color-gray-900); color: var(--spectrum-global-color-gray-900);
outline: none; outline: none;
border: none; border: none;

View File

@ -96,16 +96,18 @@
display: block; display: block;
flex: 1 1 auto; flex: 1 1 auto;
font-size: 15px; font-size: 15px;
margin-top: 18px; line-height: 17px;
color: var(--spectrum-global-color-gray-900); color: var(--spectrum-global-color-gray-900);
transition: margin-top 130ms ease-out, opacity 130ms ease-out; transition: transform 130ms ease-out, opacity 130ms ease-out;
opacity: 1; opacity: 1;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
width: 0; width: 0;
transform: translateY(9px);
} }
.value.placeholder { .value.placeholder {
transform: translateY(0);
opacity: 0; opacity: 0;
pointer-events: none; pointer-events: none;
margin-top: 0; margin-top: 0;

View File

@ -3,3 +3,4 @@ export { default as FancyCheckbox } from "./FancyCheckbox.svelte"
export { default as FancySelect } from "./FancySelect.svelte" export { default as FancySelect } from "./FancySelect.svelte"
export { default as FancyButton } from "./FancyButton.svelte" export { default as FancyButton } from "./FancyButton.svelte"
export { default as FancyForm } from "./FancyForm.svelte" export { default as FancyForm } from "./FancyForm.svelte"
export { default as FancyButtonRadio } from "./FancyButtonRadio.svelte"