Refactor CSS using nested selectors and media queries
Improves CSS organization by adopting PostCSS nesting syntax Enhances responsiveness with refined media query implementations Reduces code repetition and improves maintainability of stylesheets Modernizes CSS structure across multiple component stylesheets
This commit is contained in:
parent
29f9c79764
commit
5e2cab9bd5
6 changed files with 1539 additions and 1608 deletions
|
|
@ -29,11 +29,11 @@ swp-account-section-title {
|
|||
font-size: var(--font-size-lg);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
swp-account-section-title i {
|
||||
font-size: 22px;
|
||||
color: var(--color-teal);
|
||||
& i {
|
||||
font-size: 22px;
|
||||
color: var(--color-teal);
|
||||
}
|
||||
}
|
||||
|
||||
/* ===========================================
|
||||
|
|
@ -43,10 +43,8 @@ swp-plan-grid {
|
|||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: var(--card-gap);
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
swp-plan-grid {
|
||||
@media (max-width: 1024px) {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
|
@ -60,10 +58,8 @@ swp-billing-grid {
|
|||
display: grid;
|
||||
grid-template-columns: 380px 1fr;
|
||||
gap: var(--card-gap);
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
swp-billing-grid {
|
||||
@media (max-width: 1024px) {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
|
@ -79,6 +75,10 @@ swp-payment-card {
|
|||
border-radius: var(--radius-lg);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
|
||||
padding: var(--card-padding);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
padding: var(--spacing-5);
|
||||
}
|
||||
}
|
||||
|
||||
swp-payment-method {
|
||||
|
|
@ -100,11 +100,11 @@ swp-payment-icon {
|
|||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
swp-payment-icon i {
|
||||
font-size: 24px;
|
||||
color: var(--color-blue);
|
||||
& i {
|
||||
font-size: 24px;
|
||||
color: var(--color-blue);
|
||||
}
|
||||
}
|
||||
|
||||
swp-payment-info {
|
||||
|
|
@ -133,10 +133,10 @@ swp-payment-detail {
|
|||
align-items: center;
|
||||
padding: var(--spacing-4) 0;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
swp-payment-detail:last-of-type {
|
||||
border-bottom: none;
|
||||
&:last-of-type {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
swp-payment-label {
|
||||
|
|
@ -148,10 +148,10 @@ swp-payment-value {
|
|||
font-size: var(--font-size-base);
|
||||
font-weight: var(--font-weight-medium);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
swp-payment-value.highlight {
|
||||
color: var(--color-teal);
|
||||
&.highlight {
|
||||
color: var(--color-teal);
|
||||
}
|
||||
}
|
||||
|
||||
/* ===========================================
|
||||
|
|
@ -185,6 +185,10 @@ swp-invoices-title {
|
|||
swp-invoice-table {
|
||||
display: grid;
|
||||
grid-template-columns: 100px minmax(120px, 1fr) 100px 100px 80px;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
grid-template-columns: 80px minmax(100px, 1fr) 80px 80px 70px;
|
||||
}
|
||||
}
|
||||
|
||||
swp-invoice-table-header {
|
||||
|
|
@ -192,12 +196,26 @@ swp-invoice-table-header {
|
|||
grid-column: 1 / -1;
|
||||
grid-template-columns: subgrid;
|
||||
background: var(--color-background-alt);
|
||||
|
||||
swp-invoice-cell {
|
||||
font-size: var(--font-size-xs);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
color: var(--color-text-secondary);
|
||||
padding-top: var(--spacing-4);
|
||||
padding-bottom: var(--spacing-4);
|
||||
}
|
||||
}
|
||||
|
||||
swp-invoice-table-body {
|
||||
display: grid;
|
||||
grid-column: 1 / -1;
|
||||
grid-template-columns: subgrid;
|
||||
|
||||
swp-invoice-row:hover {
|
||||
background: var(--color-background-hover);
|
||||
}
|
||||
}
|
||||
|
||||
swp-invoice-row {
|
||||
|
|
@ -207,50 +225,45 @@ swp-invoice-row {
|
|||
align-items: center;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
transition: background var(--transition-fast);
|
||||
}
|
||||
|
||||
swp-invoice-table-body swp-invoice-row:hover {
|
||||
background: var(--color-background-hover);
|
||||
}
|
||||
|
||||
swp-invoice-row:last-child {
|
||||
border-bottom: none;
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
swp-invoice-cell {
|
||||
padding: var(--spacing-4) var(--spacing-4);
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
swp-invoice-cell:first-child {
|
||||
padding-left: var(--card-padding);
|
||||
}
|
||||
&:first-child {
|
||||
padding-left: var(--card-padding);
|
||||
}
|
||||
|
||||
swp-invoice-cell:last-child {
|
||||
padding-right: var(--card-padding);
|
||||
}
|
||||
&:last-child {
|
||||
padding-right: var(--card-padding);
|
||||
}
|
||||
|
||||
/* Header cells */
|
||||
swp-invoice-table-header swp-invoice-cell {
|
||||
font-size: var(--font-size-xs);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
color: var(--color-text-secondary);
|
||||
padding-top: var(--spacing-4);
|
||||
padding-bottom: var(--spacing-4);
|
||||
}
|
||||
&.mono {
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-xs);
|
||||
}
|
||||
|
||||
/* Invoice number mono font */
|
||||
swp-invoice-cell.mono {
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-xs);
|
||||
@media (max-width: 768px) {
|
||||
padding: var(--spacing-3) var(--spacing-3);
|
||||
|
||||
&:first-child {
|
||||
padding-left: var(--spacing-5);
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
padding-right: var(--spacing-5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ===========================================
|
||||
INVOICE STATUS BADGES
|
||||
Parent pattern with color variants + CSS nesting
|
||||
=========================================== */
|
||||
swp-invoice-status {
|
||||
display: inline-flex;
|
||||
|
|
@ -260,25 +273,25 @@ swp-invoice-status {
|
|||
font-size: var(--font-size-xs);
|
||||
font-weight: var(--font-weight-medium);
|
||||
border-radius: var(--radius-sm);
|
||||
|
||||
|
||||
& i {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
swp-invoice-status.paid {
|
||||
background: var(--bg-green-strong);
|
||||
color: var(--color-green);
|
||||
}
|
||||
&.paid {
|
||||
background: var(--bg-green-strong);
|
||||
color: var(--color-green);
|
||||
}
|
||||
|
||||
swp-invoice-status.pending {
|
||||
background: var(--bg-amber-strong);
|
||||
color: var(--color-amber);
|
||||
}
|
||||
&.pending {
|
||||
background: var(--bg-amber-strong);
|
||||
color: var(--color-amber);
|
||||
}
|
||||
|
||||
swp-invoice-status.overdue {
|
||||
background: var(--bg-red-strong);
|
||||
color: var(--color-red);
|
||||
&.overdue {
|
||||
background: var(--bg-red-strong);
|
||||
color: var(--color-red);
|
||||
}
|
||||
}
|
||||
|
||||
/* ===========================================
|
||||
|
|
@ -297,39 +310,14 @@ swp-download-btn {
|
|||
border-radius: var(--radius-sm);
|
||||
cursor: pointer;
|
||||
transition: all var(--transition-fast);
|
||||
}
|
||||
|
||||
swp-download-btn:hover {
|
||||
background: var(--bg-teal-medium);
|
||||
}
|
||||
& i {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
swp-download-btn i {
|
||||
font-size: 14px;
|
||||
&:hover {
|
||||
background: var(--bg-teal-medium);
|
||||
}
|
||||
}
|
||||
|
||||
/* Button styles in components.css */
|
||||
|
||||
/* ===========================================
|
||||
RESPONSIVE
|
||||
=========================================== */
|
||||
@media (max-width: 768px) {
|
||||
swp-invoice-table {
|
||||
grid-template-columns: 80px minmax(100px, 1fr) 80px 80px 70px;
|
||||
}
|
||||
|
||||
swp-invoice-cell {
|
||||
padding: var(--spacing-3) var(--spacing-3);
|
||||
}
|
||||
|
||||
swp-invoice-cell:first-child {
|
||||
padding-left: var(--spacing-5);
|
||||
}
|
||||
|
||||
swp-invoice-cell:last-child {
|
||||
padding-right: var(--spacing-5);
|
||||
}
|
||||
|
||||
swp-payment-card {
|
||||
padding: var(--spacing-5);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue