py-trade / src /app /dashboard /dashboard.component.scss
Hemaambika's picture
update markets page
730bef4
:host {
/* Theme variables */
--bg: #0b1020;
--card: #121a2f;
--soft: #182445;
--text: #e6ecff;
--muted: #9fb0d9;
--up: #12c48b;
--down: #ff5b6b;
--accent: #6ea8fe;
--border: #243156;
display: block;
background: var(--bg);
color: var(--text);
font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial;
}
* {
box-sizing: border-box;
}
a {
color: inherit;
text-decoration: none;
}
.wrap {
padding: 3vw;
padding-top: 8vw;
}
/* Header */
.header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 16px;
margin-bottom: 14px;
background: var(--card);
border: 1px solid var(--border);
border-radius: 12px;
}
.brand {
font-weight: 700;
letter-spacing: 0.3px;
}
.tag {
padding: 4px 10px;
border-radius: 999px;
background: var(--soft);
color: var(--muted);
font-size: 12px;
}
/* Section titles */
h2 {
font-size: 18px;
margin: 18px 0 10px;
}
.section {
background: var(--card);
border: 1px solid var(--border);
border-radius: 14px;
padding: 14px;
margin: 16px 0;
}
/* Ensure market overview ticker is clipped inside the rounded card */
.section.market-overview {
overflow: hidden; /* clip animated content to card */
position: relative; /* establish containing block for absolute/animated children */
}
/* Ticker container should also hide overflow so animation doesn't escape */
.ticker {
width: 100%;
overflow: hidden;
position: relative;
}
/* Index cards */
.indices {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 10px;
}
@media (max-width: 1100px) {
.indices {
grid-template-columns: repeat(3, 1fr);
}
}
@media (max-width: 700px) {
.indices {
grid-template-columns: repeat(2, 1fr);
}
}
/* compact .idx used for the small preview cards (top row) */
.idx {
background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0));
border: 1px solid var(--border);
border-radius: 10px;
padding: 8px; /* reduced */
min-height: 70px;
}
.idx .name {
font-weight: 600;
font-size: 13px;
}
.idx .row {
display: flex;
align-items: baseline;
gap: 8px;
margin-top: 6px;
}
.idx .price {
font-size: 16px;
font-weight: 700;
}
.idx .chg {
font-size: 12px;
padding: 2px 8px;
border-radius: 999px;
background: var(--soft);
}
.idx .mini {
margin-top: 8px;
height: 22px; /* smaller sparkline */
width: 100%;
}
.idx .mini svg {
height: 100%;
width: 100%;
}
/* Make the detailed indices grid use compact cards as well */
.indices-grid {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
@media (max-width: 1100px) {
.indices-grid {
grid-template-columns: repeat(3, 1fr);
}
}
@media (max-width: 700px) {
.indices-grid {
grid-template-columns: repeat(2, 1fr);
}
}
/* Ensure index-card component inside indices-grid stays compact */
.indices-grid .index-card {
padding: 8px;
border-radius: 10px;
min-height: 80px;
}
.indices-grid .index-card .name {
font-size: 13px;
}
.indices-grid .index-card .price {
font-size: 16px;
}
.indices-grid .index-card .mini {
height: 22px;
}
/* Tabs (indices -> companies) */
.tabs {
display: flex;
gap: 8px;
flex-wrap: wrap;
margin-bottom: 10px;
}
.tab {
background: var(--soft);
color: var(--text);
padding: 8px 12px;
border-radius: 999px;
border: 1px solid var(--border);
cursor: pointer;
}
.tab.active {
background: var(--accent);
color: #0b1020;
border-color: transparent;
}
/* Country buttons styled like tabs/pills */
.country-list {
display: flex;
gap: 8px;
align-items: center;
}
.country {
background: var(--soft);
color: var(--text);
padding: 6px 10px;
border-radius: 999px;
border: 1px solid var(--border);
cursor: pointer;
font-size: 13px;
line-height: 1;
}
.country.active {
background: var(--accent);
color: #0b1020;
border-color: transparent;
}
.tab.active, .country.active {
box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.table-wrap {
border: 1px solid var(--border);
border-radius: 12px;
overflow: auto;
}
table {
width: 100%;
border-collapse: collapse;
min-width: 620px;
}
/* Highlight selected company row: pink company name */
table tr.selected td a.co,
table tr.selected td button.co,
table tr.selected td .co {
color: #ff66b2; /* pink */
font-weight: 700;
text-decoration: underline;
}
/* also highlight entire row lightly */
table tr.selected {
background: rgba(255, 102, 178, 0.03);
}
/* Make .co elements look like inline link/buttons and be keyboard accessible */
.table-wrap td .co,
.table-wrap td a.co,
.table-wrap td button.co {
background: transparent;
border: none;
padding: 0;
margin: 0;
color: inherit;
font: inherit;
cursor: pointer;
text-align: left;
}
.table-wrap td .co:focus,
.table-wrap td .co:hover,
.table-wrap td a.co:focus,
.table-wrap td a.co:hover,
.table-wrap td button.co:focus,
.table-wrap td button.co:hover {
outline: none;
text-decoration: underline;
}
th,
td {
padding: 10px 12px;
border-bottom: 1px solid var(--border);
text-align: left;
}
th {
color: var(--muted);
font-weight: 600;
position: sticky;
top: 0;
background: var(--card);
}
.btn {
padding: 6px 10px;
border-radius: 8px;
border: 1px solid var(--border);
cursor: pointer;
font-weight: 600;
color: white;
}
.btn.buy {
background: green;
/* border-color: rgba(18, 196, 139, 0.35);*/
}
.btn.sell {
background: red;
/*border-color: rgba(255, 91, 107, 0.35);*/
}
.btn:active {
transform: translateY(1px);
}
/* Two columns */
.cols {
display: grid;
grid-template-columns: 2fr 1.4fr;
gap: 14px;
}
@media (max-width: 1000px) {
.cols {
grid-template-columns: 1fr;
}
}
/* Chart card */
.chart-card {
padding: 12px;
border: 1px solid var(--border);
border-radius: 12px;
background: var(--soft);
}
.chart-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
}
.chart-title {
font-weight: 700;
}
.legend {
font-size: 12px;
color: var(--muted);
}
canvas {
width: 100%;
height: 260px;
border-radius: 10px;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}
.chart-svg {
width: 100%;
height: 260px;
border-radius: 10px;
background: linear-gradient(180deg, rgba(255,255,255,0.01), transparent);
padding: 6px;
}
/* Sector grid */
.sector-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
}
@media (max-width: 900px) {
.sector-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 600px) {
.sector-grid {
grid-template-columns: 1fr;
}
}
.sector {
border: 1px solid var(--border);
border-radius: 12px;
padding: 12px;
background: var(--soft);
}
.sector h3 {
margin: 0 0 8px;
font-size: 15px;
}
.pill {
display: inline-block;
margin: 6px 8px 0 0;
padding: 6px 10px;
border-radius: 999px;
background: var(--card);
border: 1px solid var(--border);
font-size: 13px;
}
/* Toppers/Losers */
.dual {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 14px;
}
@media (max-width: 900px) {
.dual {
grid-template-columns: 1fr;
}
}
.uptext {
color: var(--up);
font-weight: 700;
}
.downtext {
color: var(--down);
font-weight: 700;
}
/* Footer note */
.note {
color: var(--muted);
font-size: 12px;
margin-top: 6px;
}
/* Improve the marquee so the market overview cards run smoothly right-to-left. Use a CSS variable for duration, make the track width adapt to content and translate by -50% for seamless loop. Add will-change and hardware-accelerated transform, and ensure .mcard are non-shrinking. */
.ticker-track {
display: flex;
gap: 16px;
align-items: center;
padding: 12px 8px;
/* ensure items don't shrink and track width matches content (we duplicate items in template) */
white-space: nowrap;
will-change: transform;
--marquee-duration: 28s; /* adjust speed */
animation: marquee var(--marquee-duration) linear infinite;
}
.mcard {
flex: 0 0 auto; /* prevent shrinking/expanding */
min-width: 160px;
max-width: 260px;
padding: 8px 12px;
border-radius: 10px;
background: rgba(255,255,255,0.02);
border: 1px solid rgba(255,255,255,0.02);
}
@keyframes marquee {
0% {
transform: translateX(0);
}
100% {
transform: translateX(-50%);
}
}
/* Inline styles for index-card moved here */
.index-card {
background: rgba(255,255,255,0.02);
padding: 12px;
border-radius: 8px;
min-width: 260px;
margin: 6px;
}
.ic-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.ic-name {
font-weight: 600;
font-size: 0.95rem;
}
.ic-price {
font-weight: 700;
}
.ic-row {
margin-top: 6px;
}
.ic-change.up {
color: var(--up);
}
.ic-change.down {
color: var(--down);
}
.ic-spark {
width: 100%;
height: 28px;
margin-top: 8px;
}