generated from argyleink/vite-postcss-preset-env
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement clickable color swatches to copy color props to clipboard (#…
…476) * replace color swatch spans with buttons * add click to copy functionality * update color swatch css for use with buttons * add basic markup and rough styles for copy option selector * move color copy css to separate file * move javascript to separate file * add tooltip functionality and styles * update index.css for tooltips * implement selecting format for copied color * change tooltip style to match buttons * clean up js * move checkbox outside of label and refactor css to match * started implementing roving-ux * replaced color swatches with lists * style copy type selectors * added missing 12th color swatch * remove unnecessary classes * update package-lock * fix mobile layout and make tooltips unclickable * fix animation not playing when first clicking * fix misshapen outline on tabover * fix color of copy options when light mode * fix ease squish animation speed * change copy example to reflect default selected option * Apply suggestions from code review Co-authored-by: Adam Argyle <[email protected]> * move color conversion to separate file --------- Co-authored-by: Adam Argyle <[email protected]>
- Loading branch information
Showing
8 changed files
with
732 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
.copy-options { | ||
font-family: var(--font-sans); | ||
display: flex; | ||
flex-wrap: wrap; | ||
flex-direction: row; | ||
gap: var(--size-3); | ||
|
||
& .example { | ||
font-style: italic; | ||
color: var(--text-2); | ||
} | ||
|
||
[data-theme="light"] & .example { | ||
color: var(--gray-7); | ||
} | ||
|
||
& input:is(:disabled) { | ||
cursor: not-allowed; | ||
|
||
&~label { | ||
color: var(--gray-5); | ||
cursor: not-allowed; | ||
} | ||
} | ||
|
||
@media (--md-n-below) { | ||
flex-direction: column; | ||
} | ||
} | ||
|
||
.options { | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: var(--size-7); | ||
align-items: center; | ||
justify-content: flex-start; | ||
padding-inline: var(--size-4); | ||
padding-block: var(--size-3); | ||
margin: var(--size-2) 0; | ||
overflow: auto; | ||
border-radius: var(--radius-conditional-2); | ||
border: var(--border-size-1) solid var(--surface-3); | ||
background: white; | ||
box-shadow: var(--shadow-4); | ||
|
||
[data-theme="dark"] & { | ||
background: var(--surface-2); | ||
box-shadow: var(--shadow-3); | ||
} | ||
|
||
@media (max-width: 768px) { | ||
flex-direction: column; | ||
align-items: start; | ||
} | ||
} | ||
|
||
.options:nth-child(2) { | ||
gap: var(--size-5); | ||
} | ||
|
||
.input-group { | ||
display: flex; | ||
align-items: center; | ||
/* justify-content: flex-start; */ | ||
& > label { | ||
padding-inline-start: var(--size-2); | ||
} | ||
} | ||
|
||
.color-format:has(:disabled) { | ||
color: var(--gray-5); | ||
} | ||
|
||
.tooltip { | ||
position: absolute; | ||
left: 50%; | ||
transform: translateX(-50%); | ||
top: -100%; | ||
min-width: max-content; | ||
border-radius: var(--radius-round); | ||
padding: var(--size-1) var(--size-2); | ||
font-size: var(--size-2); | ||
background-color: #000; | ||
color: #fff; | ||
z-index: 9999; | ||
pointer-events: none; | ||
|
||
} | ||
|
||
.tooltip-show { | ||
animation: var(--animation-fade-in) forwards; | ||
animation-duration: 0.5s; | ||
} | ||
|
||
.tooltip-hide { | ||
animation: var(--animation-fade-out) forwards; | ||
animation-duration: 0.5s; | ||
} | ||
|
||
.color-swatch:has(.tooltip) { | ||
position: relative; | ||
} | ||
|
||
.color-swatch-list { | ||
list-style: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.