feat: Implement Algolia DocSearch, enhance MDX components, and update build configurations.
This commit is contained in:
162
styles/algolia.css
Normal file
162
styles/algolia.css
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
================================================================================
|
||||
DocSearch Component Styling (Refactored Version)
|
||||
================================================================================
|
||||
*/
|
||||
|
||||
/* -- LANGKAH 1: Definisi Variabel Global --
|
||||
Variabel tema DocSearch sekarang didefinisikan secara global di :root.
|
||||
Ini menyederhanakan pewarisan tema dan memastikan konsistensi.
|
||||
Mode gelap secara otomatis menimpa variabel ini karena .dark di globals.css.
|
||||
*/
|
||||
:root {
|
||||
--docsearch-primary-color: hsl(var(--primary));
|
||||
--docsearch-text-color: hsl(var(--muted-foreground));
|
||||
--docsearch-spacing: 12px;
|
||||
--docsearch-icon-stroke-width: 1.4;
|
||||
--docsearch-highlight-color: var(--docsearch-primary-color);
|
||||
--docsearch-muted-color: hsl(var(--muted-foreground));
|
||||
--docsearch-container-background: rgba(0, 0, 0, 0.7);
|
||||
--docsearch-logo-color: hsl(var(--primary-foreground));
|
||||
|
||||
/* Modal */
|
||||
--docsearch-modal-width: 560px;
|
||||
--docsearch-modal-height: 600px;
|
||||
--docsearch-modal-background: hsl(var(--background));
|
||||
--docsearch-modal-shadow: 0 0 0 1px hsl(var(--border)), 0 8px 20px rgba(0, 0, 0, 0.2);
|
||||
|
||||
/* SearchBox */
|
||||
--docsearch-searchbox-height: 56px;
|
||||
--docsearch-searchbox-background: hsl(var(--input));
|
||||
--docsearch-searchbox-focus-background: hsl(var(--card));
|
||||
--docsearch-searchbox-shadow: none;
|
||||
|
||||
/* Hit (Hasil Pencarian) */
|
||||
--docsearch-hit-height: 56px;
|
||||
--docsearch-hit-color: hsl(var(--foreground));
|
||||
--docsearch-hit-active-color: hsl(var(--primary-foreground));
|
||||
--docsearch-hit-background: hsl(var(--card));
|
||||
--docsearch-hit-shadow: none;
|
||||
|
||||
/* Keys */
|
||||
--docsearch-key-gradient: none;
|
||||
--docsearch-key-shadow: none;
|
||||
--docsearch-key-pressed-shadow: none;
|
||||
|
||||
/* Footer */
|
||||
--docsearch-footer-height: 44px;
|
||||
--docsearch-footer-background: hsl(var(--background));
|
||||
--docsearch-footer-shadow: none;
|
||||
}
|
||||
|
||||
/* -- LANGKAH 2: Gaya untuk Tombol Awal --
|
||||
Gaya ini spesifik untuk tombol yang ada di Navbar,
|
||||
yang dibungkus oleh <div class="docsearch">.
|
||||
*/
|
||||
.docsearch .DocSearch-Button {
|
||||
background-color: hsl(var(--secondary));
|
||||
border: 1px solid hsl(var(--border));
|
||||
border-radius: 9999px;
|
||||
width: 160px;
|
||||
height: 40px;
|
||||
color: hsl(var(--muted-foreground));
|
||||
transition: width 0.3s ease;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.docsearch .DocSearch-Button:hover {
|
||||
border-color: var(--docsearch-primary-color);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.docsearch .DocSearch-Search-Icon {
|
||||
color: var(--docsearch-muted-color);
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
}
|
||||
|
||||
.docsearch .DocSearch-Button-Placeholder {
|
||||
font-style: normal;
|
||||
margin-left: 0.25rem;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.25rem;
|
||||
color: var(--docsearch-muted-color);
|
||||
}
|
||||
|
||||
.docsearch .DocSearch-Button-Key {
|
||||
background: var(--docsearch-primary-color);
|
||||
color: var(--docsearch-logo-color); /* Menggunakan variabel yg relevan */
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
height: 24px;
|
||||
padding: 0 6px;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/* -- LANGKAH 3: Gaya untuk Modal dan Isinya --
|
||||
Gaya ini menargetkan elemen-elemen modal yang dirender terpisah.
|
||||
Karena variabel sudah global, kita hanya perlu menata elemennya.
|
||||
*/
|
||||
.DocSearch-Container .DocSearch-Modal {
|
||||
backdrop-filter: blur(8px);
|
||||
}
|
||||
|
||||
.DocSearch-Form {
|
||||
border: 1px solid hsl(var(--border));
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.DocSearch-Input {
|
||||
font-size: 15px !important;
|
||||
}
|
||||
|
||||
.DocSearch-Footer {
|
||||
border-top: 1px solid hsl(var(--border));
|
||||
}
|
||||
|
||||
/* Gaya untuk tombol keyboard di footer */
|
||||
.DocSearch-Footer--commands kbd {
|
||||
background-color: hsl(var(--secondary));
|
||||
border: 1px solid hsl(var(--border));
|
||||
border-bottom-width: 2px;
|
||||
border-radius: 6px;
|
||||
color: var(--docsearch-muted-color);
|
||||
padding: 4px 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* Menghilangkan gaya default dari ikon di dalam tombol footer */
|
||||
.DocSearch-Commands-Key {
|
||||
background: none;
|
||||
color: hsl(var(--muted-foreground));
|
||||
border: 1px solid hsl(var(--border));
|
||||
box-shadow: none;
|
||||
padding: 2px 4px;
|
||||
margin-right: 0.4em;
|
||||
height: 20px;
|
||||
width: 32px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
/* -- LANGKAH 4: Gaya Responsif --
|
||||
Tidak ada perubahan, hanya mempertahankan fungsionalitas mobile.
|
||||
*/
|
||||
@media (max-width: 768px) {
|
||||
.docsearch .DocSearch-Button {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
padding: 0;
|
||||
justify-content: center;
|
||||
background: none;
|
||||
border: none;
|
||||
}
|
||||
.docsearch .DocSearch-Button-Placeholder,
|
||||
.docsearch .DocSearch-Button-Key {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user