refactor(styles): migrate hardcoded CSS values to variables
* Define global variables for colors, layout, and spacing scales in * Replace hardcoded padding, gap, color, and border values with CSS variables across guide components (, , , , ) * Add utility class to guide frames in for unified styling
This commit is contained in:
parent
075e41ec89
commit
a329ed1cbe
7 changed files with 70 additions and 100 deletions
|
|
@ -3,14 +3,14 @@
|
|||
place-items: center;
|
||||
cursor: pointer;
|
||||
border-style: dashed;
|
||||
padding: 2rem;
|
||||
padding: var(--size-lg);
|
||||
font-weight: bold;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
border-color: #ff770080;
|
||||
color: #ff7700;
|
||||
background-color: #ff770010;
|
||||
border-color: var(--color-accent-border);
|
||||
color: var(--color-accent);
|
||||
background-color: var(--color-accent-bg-subtle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,27 +1,22 @@
|
|||
.frame {
|
||||
padding: 1rem;
|
||||
background: #ddd;
|
||||
|
||||
padding: var(--size-md);
|
||||
background: var(--color-bg-panel);
|
||||
border-left: 3px solid var(--color-accent-border);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
gap: var(--size-md);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
.frame .buttons {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
gap: var(--size-md);
|
||||
}
|
||||
|
||||
.frame .buttons button {
|
||||
padding: 0.5rem 1rem;
|
||||
padding: var(--size-sm) var(--size-md);
|
||||
}
|
||||
|
||||
.frame .buttons .remove {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.frame .steps {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
.step {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
gap: var(--size-md);
|
||||
}
|
||||
|
||||
.step label {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
gap: var(--size-sm);
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,73 +1,61 @@
|
|||
main:has(.guide) {
|
||||
padding: 1rem 7rem;
|
||||
padding: var(--size-md) 7rem;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.guide__frames {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3rem;
|
||||
gap: var(--size-xl);
|
||||
}
|
||||
.guide {
|
||||
max-width: 600px;
|
||||
|
||||
.delete-button {
|
||||
position: absolute;
|
||||
bottom: 1rem;
|
||||
right: 1rem;
|
||||
bottom: var(--size-md);
|
||||
right: var(--size-md);
|
||||
}
|
||||
|
||||
.edit-button {
|
||||
position: absolute;
|
||||
top: 1rem;
|
||||
top: var(--size-md);
|
||||
right: 8rem;
|
||||
}
|
||||
|
||||
.export-button {
|
||||
position: absolute;
|
||||
top: 1rem;
|
||||
right: 1rem;
|
||||
top: var(--size-md);
|
||||
right: var(--size-md);
|
||||
}
|
||||
|
||||
.guide__frame {
|
||||
padding: 1rem;
|
||||
background-color: #dedede;
|
||||
padding: var(--size-md);
|
||||
background-color: var(--color-bg-panel);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
gap: var(--size-sm);
|
||||
}
|
||||
|
||||
.guide__frame img {
|
||||
max-height: 350px;
|
||||
object-fit: contain;
|
||||
object-position: left center;
|
||||
}
|
||||
|
||||
.guide__frame ol {
|
||||
margin-left: 1rem;
|
||||
margin-left: var(--size-md);
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
main:has(.guide) {
|
||||
padding: 0rem;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.guide__frames {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.guide__frame {
|
||||
position: relative;
|
||||
break-inside: avoid;
|
||||
page-break-inside: avoid;
|
||||
background-color: #dedede;
|
||||
|
||||
margin: 2rem 0;
|
||||
background-color: var(--color-bg-panel);
|
||||
margin: var(--size-lg) 0;
|
||||
}
|
||||
|
||||
.guide__frame img {
|
||||
max-width: 100%;
|
||||
max-height: 100px;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export default function Guide() {
|
|||
|
||||
<div className="guide__frames">
|
||||
{guide.frames.map((frame, index) => (
|
||||
<div key={index} className="guide__frame">
|
||||
<div key={index} className="guide__frame frame">
|
||||
<h2>{frame.title}</h2>
|
||||
<img src={URL.createObjectURL(frame.file)} alt={frame.title} />
|
||||
|
||||
|
|
|
|||
|
|
@ -3,16 +3,13 @@
|
|||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.new-guide__form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2rem;
|
||||
|
||||
gap: var(--size-lg);
|
||||
width: 100%;
|
||||
max-width: 540px;
|
||||
}
|
||||
|
||||
.new-guide__form label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
|
|
|||
|
|
@ -1,114 +1,114 @@
|
|||
:root {
|
||||
/* color */
|
||||
--color-border: #ccc;
|
||||
--color-bg-sidebar: #eee;
|
||||
--sidebar-width: 250px;
|
||||
--gap-nav: 1rem;
|
||||
}
|
||||
--color-bg-panel: #fafafa;
|
||||
--color-accent: #ff7700;
|
||||
--color-accent-hover: #ff9900;
|
||||
--color-accent-border: #ff770080;
|
||||
--color-accent-bg-subtle: #ff770010;
|
||||
|
||||
/* layout */
|
||||
--sidebar-width: 250px;
|
||||
--radius: 4px;
|
||||
|
||||
/* spacing scale */
|
||||
--size-xs2: 0.125rem;
|
||||
--size-xs: 0.25rem;
|
||||
--size-sm: 0.5rem;
|
||||
--size-md: 1rem;
|
||||
--size-lg: 2rem;
|
||||
--size-xl: 3rem;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
font-family: system-ui, Arial, sans-serif;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#root {
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.app-body {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
header {
|
||||
position: fixed;
|
||||
height: 100%;
|
||||
width: var(--sidebar-width);
|
||||
padding: 1rem;
|
||||
padding: var(--size-md);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: var(--gap-nav);
|
||||
gap: var(--size-sm);
|
||||
border-right: 3px solid var(--color-border);
|
||||
background-color: var(--color-bg-sidebar);
|
||||
|
||||
.main-title a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.create-new-guide-btn {
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 4px;
|
||||
background-color: #ff7700;
|
||||
padding: var(--size-sm) var(--size-md);
|
||||
border-radius: var(--radius);
|
||||
background-color: var(--color-accent);
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.guide-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin-top: 0.5rem;
|
||||
margin-top: var(--size-sm);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
gap: var(--size-sm);
|
||||
}
|
||||
}
|
||||
|
||||
main {
|
||||
margin-left: var(--sidebar-width);
|
||||
flex: 1;
|
||||
padding: 1rem;
|
||||
padding: var(--size-md);
|
||||
}
|
||||
|
||||
footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
margin: 0 auto;
|
||||
padding: 0.5rem;
|
||||
padding: var(--size-sm);
|
||||
text-align: center;
|
||||
width: var(--sidebar-width);
|
||||
}
|
||||
|
||||
nav {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
padding-bottom: 2rem;
|
||||
padding-bottom: var(--size-lg);
|
||||
width: 100%;
|
||||
|
||||
a {
|
||||
padding: 0.6rem 1rem 0.5rem;
|
||||
border-radius: 4px;
|
||||
padding: 0.6rem var(--size-md) 0.5rem;
|
||||
border-radius: var(--radius);
|
||||
line-height: 1;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.settings-btn {
|
||||
margin-top: auto;
|
||||
align-self: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.settings-btn.active {
|
||||
margin-top: auto;
|
||||
align-self: center;
|
||||
color: #ff7700;
|
||||
color: var(--color-accent);
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-top: 2rem;
|
||||
margin-top: var(--size-lg);
|
||||
font-size: 1rem;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
li {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.guide-list a {
|
||||
transition:
|
||||
background-color 0.125s,
|
||||
|
|
@ -116,25 +116,22 @@ nav {
|
|||
background-color: #fff;
|
||||
border-left: 4px solid var(--color-border);
|
||||
}
|
||||
|
||||
.guide-list a.active {
|
||||
background-color: #fff;
|
||||
border-left: 4px solid #ff7700;
|
||||
border-left: 4px solid var(--color-accent);
|
||||
}
|
||||
.guide-list a:hover:not(.active) {
|
||||
border-left: 4px solid #ff9900;
|
||||
border-left: 4px solid var(--color-accent-hover);
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.125rem;
|
||||
gap: var(--size-xs);
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
a,
|
||||
input,
|
||||
button,
|
||||
|
|
@ -144,37 +141,30 @@ textarea {
|
|||
font-size: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
input,
|
||||
textarea,
|
||||
.file-upload {
|
||||
border: 3px solid var(--color-border);
|
||||
border-radius: 4px;
|
||||
padding: 0.25rem;
|
||||
border: 2px solid var(--color-bg-sidebar);
|
||||
border-radius: var(--radius);
|
||||
padding: var(--size-sm);
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: none;
|
||||
height: 5rem;
|
||||
}
|
||||
|
||||
hr {
|
||||
margin: 1rem 0;
|
||||
margin: var(--size-md) 0;
|
||||
border: none;
|
||||
height: 3px;
|
||||
background-color: var(--color-border);
|
||||
border-radius: 4px;
|
||||
background-color: var(--color-bg-sidebar);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
:focus-visible {
|
||||
outline: 2px solid #ff7700;
|
||||
outline-offset: 2px;
|
||||
border: 2px solid var(--color-accent);
|
||||
}
|
||||
|
||||
@media print {
|
||||
header,
|
||||
footer,
|
||||
|
|
|
|||
Loading…
Reference in a new issue