jattac.react.recents
Version:
A React component and utility for tracking and displaying recent browser locations and URLs.
161 lines (139 loc) • 2.83 kB
CSS
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* Mobile-first base styles */
.recentsContainer {
padding: 12px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
Arial, sans-serif;
animation: fadeIn 0.5s ease-in-out;
width: 100%;
box-sizing: border-box;
}
.recentsTitle {
font-size: 1.2em;
font-weight: 600;
margin-bottom: 16px;
display: flex;
justify-content: space-between;
align-items: center;
}
.removeAllButton {
background-color: #f44336;
color: white;
border: none;
padding: 6px 10px;
border-radius: 4px;
cursor: pointer;
font-size: 0.8rem;
transition: background-color 0.3s ease;
}
.recentsList {
list-style: none;
padding: 0;
margin: 0;
}
.recentItem {
display: flex;
flex-wrap: wrap; /* Allow items to wrap */
align-items: center;
padding: 10px 4px;
margin-bottom: 8px;
border-radius: 6px;
transition: background-color 0.3s ease;
}
.recentItem:hover {
background-color: #f5f5f5;
}
.favicon {
width: 20px;
height: 20px;
margin-right: 12px;
flex-shrink: 0;
}
.recentLink {
color: #333;
text-decoration: none;
font-size: 1rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
/* Take up most of the space, but leave room for the button */
flex-basis: calc(100% - 80px);
flex-grow: 1;
}
.recentLink:hover {
text-decoration: underline;
}
.timeLabel {
font-size: 0.8rem;
color: #666;
flex-basis: 100%; /* Make time take full width on new line */
margin-top: 4px;
padding-left: 32px; /* Align with text, not favicon */
}
.removeButton {
background: transparent;
border: none;
cursor: pointer;
color: #9e9e9e;
padding: 4px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
transition: background-color 0.3s ease, color 0.3s ease;
margin-left: auto; /* Pushes button to the far right */
}
.removeButton:hover {
background-color: #e0e0e0;
color: #d32f2f;
}
.noRecents {
text-align: center;
padding: 32px;
border: 2px dashed #e0e0e0;
border-radius: 8px;
}
.noRecentsText {
font-size: 1rem;
color: #666;
}
/* Desktop-aware styles */
@media (min-width: 768px) {
.recentsContainer {
max-width: 600px;
margin: 0 auto;
padding: 16px;
}
.recentsTitle {
font-size: 1.25em;
}
.removeAllButton {
padding: 6px 12px;
font-size: 0.875rem;
}
.recentItem {
flex-wrap: nowrap; /* Prevent wrapping on desktop */
}
.recentLink {
flex-basis: auto; /* Reset basis */
}
.timeLabel {
flex-basis: auto; /* Reset basis */
margin-top: 0;
padding-left: 0;
margin-left: 16px;
font-size: 0.875rem;
}
.removeButton {
margin-left: 16px;
}
}