docs-v2/assets/styles/components/_format-selector.scss

244 lines
4.7 KiB
SCSS

/**
* Format Selector Component Styles
*
* Dropdown menu for accessing documentation in LLM-friendly formats.
* Uses theme colors to match light/dark modes.
*/
.format-selector {
position: relative;
display: inline-flex;
align-items: center;
margin-left: auto; // Right-align in title container
margin-top: 0.5rem;
// Position near article title
.title & {
margin-left: auto;
}
}
.format-selector__button {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 0.75rem;
background: $sidebar-search-bg;
color: $article-text;
border: 1px solid $nav-border;
border-radius: $radius;
font-size: 14px;
font-weight: 500;
line-height: 1;
cursor: pointer;
transition: all 0.2s ease;
white-space: nowrap;
box-shadow: 2px 2px 6px $sidebar-search-shadow;
&:hover {
border-color: $sidebar-search-highlight;
box-shadow: 1px 1px 10px rgba($sidebar-search-highlight, .5);
}
&:focus {
outline: 2px solid $sidebar-search-highlight;
outline-offset: 2px;
}
&[aria-expanded='true'] {
border-color: $sidebar-search-highlight;
.format-selector__button-arrow svg {
transform: rotate(180deg);
}
}
}
.format-selector__button-icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 16px;
height: 16px;
svg {
width: 100%;
height: 100%;
color: $nav-item;
}
}
.format-selector__button-text {
font-size: 14px;
font-weight: 500;
}
.format-selector__button-arrow {
display: inline-flex;
align-items: center;
justify-content: center;
width: 12px;
height: 12px;
margin-left: 0.25rem;
svg {
width: 100%;
height: 100%;
transition: transform 0.2s ease;
}
}
// Dropdown menu
.format-selector__dropdown {
position: fixed; // Use fixed to break out of parent stacking context
// Position will be calculated by JavaScript to align with button
min-width: 280px;
max-width: 320px;
background: $article-bg;
border: 1px solid $nav-border;
border-radius: 8px;
box-shadow: 2px 2px 6px $article-shadow;
padding: 0.5rem;
z-index: 10000; // Higher than sidebar and other elements
opacity: 0;
visibility: hidden;
transform: translateY(-8px);
transition: all 0.2s ease;
pointer-events: none;
&.is-open {
opacity: 1;
visibility: visible;
transform: translateY(0);
pointer-events: auto;
}
}
// Dropdown options (buttons and links)
.format-selector__option {
display: flex;
align-items: flex-start;
gap: 0.75rem;
width: 100%;
padding: 0.75rem;
background: transparent;
color: $article-text;
border: none;
border-radius: $radius;
text-align: left;
text-decoration: none;
cursor: pointer;
transition: background 0.15s ease;
&:hover {
background: $sidebar-search-bg;
color: $nav-item-hover;
}
&:focus {
outline: 2px solid $sidebar-search-highlight;
outline-offset: -2px;
}
&:not(:last-child) {
margin-bottom: 0.25rem;
}
}
.format-selector__icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
flex-shrink: 0;
margin-top: 2px; // Align with first line of text
svg {
width: 100%;
height: 100%;
// Support both stroke and fill-based icons
stroke: $nav-item;
// For fill-based icons (like OpenAI Blossom), use currentColor
[fill]:not([fill="none"]):not([fill="white"]) {
fill: $nav-item;
}
}
}
.format-selector__label-group {
display: flex;
flex-direction: column;
gap: 0.25rem;
flex: 1;
min-width: 0; // Allow text truncation
}
.format-selector__label {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 14px;
font-weight: 500;
line-height: 1.3;
color: $article-text;
}
.format-selector__external {
display: inline-flex;
align-items: center;
font-size: 12px;
color: $nav-item;
margin-left: 0.25rem;
opacity: 0.7;
}
.format-selector__sublabel {
font-size: 12px;
line-height: 1.4;
color: $nav-item;
}
// Responsive adjustments
@media (max-width: 768px) {
.format-selector {
// Stack vertically on mobile
margin-left: 0;
margin-top: 1rem;
}
.format-selector__dropdown {
right: auto;
left: 0;
min-width: 100%;
max-width: 100%;
}
}
// Theme styles are now automatically handled by SCSS variables
// that switch based on the active theme (light/dark)
// Ensure dropdown appears above other content
.format-selector__dropdown {
isolation: isolate;
}
// Animation for notification (temporary toast)
@keyframes slideInUp {
from {
transform: translateY(100%);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
// Add smooth transitions
* {
box-sizing: border-box;
}