docs/.vitepress/theme/components/SettingsPanel.vue

107 lines · 2298 bytes

  1<script setup lang="ts">
  2import { ArrowLeft } from 'lucide-vue-next'
  3import { settingsOpen } from '../settingsState'
  4import { NolebaseEnhancedReadabilitiesScreenMenu } from './settings'
  5</script>
  6
  7<template>
  8  <Teleport to="body">
  9    <Transition name="settings-panel">
 10      <div
 11        v-if="settingsOpen"
 12        class="settings-panel"
 13        role="dialog"
 14        aria-label="Settings"
 15      >
 16        <div class="settings-header">
 17          <button
 18            type="button"
 19            class="settings-back"
 20            aria-label="Back"
 21            @click="settingsOpen = false"
 22          >
 23            <ArrowLeft :size="18" :stroke-width="2" />
 24          </button>
 25          <span class="settings-title">Settings</span>
 26        </div>
 27        <div class="settings-body">
 28          <NolebaseEnhancedReadabilitiesScreenMenu />
 29        </div>
 30      </div>
 31    </Transition>
 32  </Teleport>
 33</template>
 34
 35<style scoped>
 36.settings-panel {
 37  position: fixed;
 38  inset: 0;
 39  z-index: 9999;
 40  display: flex;
 41  flex-direction: column;
 42  background-color: var(--vp-c-bg);
 43}
 44
 45.settings-header {
 46  display: flex;
 47  align-items: center;
 48  height: 49px;
 49  flex-shrink: 0;
 50  padding: 6px 8px;
 51  border-bottom: 1px solid var(--wk-fs-header-divider);
 52}
 53
 54.settings-back {
 55  display: flex;
 56  align-items: center;
 57  justify-content: center;
 58  padding: 8px;
 59  border: none;
 60  background: transparent;
 61  color: var(--vp-c-text-1);
 62  cursor: pointer;
 63  transition: color 0.15s;
 64}
 65
 66.settings-back:hover {
 67  color: var(--vp-c-brand-1);
 68}
 69
 70.settings-title {
 71  font-size: 16px;
 72  font-weight: 600;
 73  color: var(--vp-c-text-1);
 74}
 75
 76.settings-body {
 77  flex: 1;
 78  min-height: 0;
 79  overflow-y: auto;
 80  overscroll-behavior: contain;
 81  padding: 20px;
 82}
 83
 84/* Centered column, matching the old nav-screen settings layout (288px). */
 85.settings-body :deep(.VPNolebaseEnhancedReadabilitiesMenu) {
 86  max-width: 288px;
 87  margin-inline: auto;
 88}
 89
 90/* Only ever opened from the phone gear; never show on desktop. */
 91@media (min-width: 768px) {
 92  .settings-panel {
 93    display: none;
 94  }
 95}
 96
 97.settings-panel-enter-active,
 98.settings-panel-leave-active {
 99  transition: opacity 0.2s, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
100}
101
102.settings-panel-enter-from,
103.settings-panel-leave-to {
104  opacity: 0;
105  transform: translateY(8px);
106}
107</style>