Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add css reset from @scalar/themes #124

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 49 additions & 45 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useMediaQuery } from '@vueuse/core'
import ModeToggleButton from './components/ModeToggleButton.vue'
import GitHubLogo from './components/GithubLogo.vue'
import ScalarLogo from './components/ScalarLogo.vue'
import { ThemeStyles } from '@scalar/themes'
import { ResetStyles, ThemeStyles } from '@scalar/themes'
import { useDarkMode } from './hooks/useDarkMode'

const isDark = useDarkMode()
Expand Down Expand Up @@ -156,54 +156,58 @@ onUnmounted(() => {
</script>

<template>
<Toaster theme="dark" />
<ThemeStyles id="default" />
<FileDrop @drop="handleDrop">
<div class="app">
<header class="header">
<div class="logo">
<ScalarLogo />
<div class="logo-text">Sandbox</div>
</div>
<div class="mode">
<ModeToggleButton v-model="editing" />
</div>
<div class="actions">
<DarkModeToggle />
<a href="https://github.com/scalar/scalar">
<GitHubLogo />
</a>
<ShareButton
@click="share"
:loading="loading" />
</div>
</header>
<div class="layout">
<!-- Mobile Layout -->
<template v-if="isMobile">
<div v-if="editing">
<MonacoEditor v-model="content" />
<ResetStyles v-slot="{ styles }">
<Toaster theme="dark" />
<ThemeStyles id="default" />
<FileDrop @drop="handleDrop">
<div
class="app"
:class="styles">
<header class="header">
<div class="logo">
<ScalarLogo />
<div class="logo-text">Sandbox</div>
</div>
<div v-else>
<ApiReference
:configuration="{ spec: { content }, darkMode: isDark }" />
<div class="mode">
<ModeToggleButton v-model="editing" />
</div>
</template>
<!-- Desktop Layout -->
<template v-else>
<div
class="left"
v-if="editing">
<MonacoEditor v-model="content" />
<div class="actions">
<DarkModeToggle />
<a href="https://github.com/scalar/scalar">
<GitHubLogo />
</a>
<ShareButton
@click="share"
:loading="loading" />
</div>
<div class="right">
<ApiReference
:configuration="{ spec: { content }, darkMode: isDark }" />
</div>
</template>
</header>
<div class="layout">
<!-- Mobile Layout -->
<template v-if="isMobile">
<div v-if="editing">
<MonacoEditor v-model="content" />
</div>
<div v-else>
<ApiReference
:configuration="{ spec: { content }, darkMode: isDark }" />
</div>
</template>
<!-- Desktop Layout -->
<template v-else>
<div
class="left"
v-if="editing">
<MonacoEditor v-model="content" />
</div>
<div class="right">
<ApiReference
:configuration="{ spec: { content }, darkMode: isDark }" />
</div>
</template>
</div>
</div>
</div>
</FileDrop>
</FileDrop>
</ResetStyles>
</template>

<style scoped>
Expand Down
9 changes: 8 additions & 1 deletion src/components/ShareButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ defineEmits<{
font-size: var(--scalar-small);
padding: 6px 12px;
border-radius: var(--scalar-radius-lg);
transition: all 0.5s ease-in-out;
cursor: pointer;
}
.button:hover {
background: color-mix(
in srgb,
var(--scalar-color-1),
var(--scalar-background-3) 95%
);
}

.button[disabled] {
Expand Down