gov-gui
Version:
Gov UI Component Library Typscript Build
145 lines (122 loc) • 2.4 kB
CSS
:host {
display: block;
}
.card {
display: flex;
background: var(--white-color);
border-radius: 12px;
border: 1px solid var(--white-color);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
overflow: hidden;
min-width: 300px;
}
/* Vertical layout */
.card.vertical {
flex-direction: column;
max-width: 400px;
}
/* Horizontal layout */
.card.horizontal {
flex-direction: row;
max-width: 600px;
}
.image-container {
position: relative;
overflow: hidden;
}
.image-container[data-clip="cover"] img {
width: 100%;
height: 100%;
object-fit: cover;
}
.image-container[data-clip="contain"] img {
width: 100%;
height: 100%;
object-fit: contain;
}
.image-container[data-clip="fill"] img {
width: 100%;
height: 100%;
object-fit: fill;
}
.image-container[data-clip="none"] img {
width: auto;
height: auto;
}
.card.vertical .image-container {
aspect-ratio: 16/9;
}
.card.horizontal .image-container {
width: 40%;
min-width: 150px;
}
img {
display: block;
}
.content {
padding: 1rem;
color: var(--black-color);
flex: 1;
display: flex;
flex-direction: column;
}
h2 {
margin: 0 0 0.5rem 0;
font-size: 1.25rem;
}
.description {
margin: 0 0 1rem 0;
font-size: 14px;
line-height: 1.5;
color: var(--black-color);
position: relative;
max-height: 4.5em; /* Approx 3 lines */
overflow: hidden;
}
.description.expanded {
max-height: none;
}
.text-wrapper {
display: inline;
}
.description .show-more,
.description .show-less {
color: var(--primary-color);
cursor: pointer;
margin-left: 5px;
font-weight: bold;
position: absolute;
bottom: 0;
right: 0;
background: var(--white-color);
padding-left: 5px;
}
.description.expanded .show-more {
display: none;
}
.description:not(.expanded) .show-less {
display: none;
}
button {
background-color: var(--primary-color);
color: var(--white-color);
border: none;
padding: 0.5rem 1rem;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: opacity 0.2s;
align-self: flex-start;
}
button:hover {
opacity: 0.9;
}
@media (max-width: 480px) {
.card.horizontal {
flex-direction: column;
}
.card.horizontal .image-container {
width: 100%;
aspect-ratio: 16/9;
}
}