-
-
Notifications
You must be signed in to change notification settings - Fork 929
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' into feat/boolean-probability
- Loading branch information
Showing
32 changed files
with
1,074 additions
and
411 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<script setup lang="ts"> | ||
import { useElementSize } from '@vueuse/core'; | ||
import { ref, watchEffect } from 'vue'; | ||
defineProps<{ | ||
version: string; | ||
}>(); | ||
const el = ref<HTMLElement>(); | ||
const { height } = useElementSize(el); | ||
watchEffect(() => { | ||
if (height.value) { | ||
document.documentElement.style.setProperty( | ||
'--vp-layout-top-height', | ||
`${height.value + 16}px` | ||
); | ||
} | ||
}); | ||
const dismiss = () => { | ||
localStorage.setItem( | ||
'faker-version-banner', | ||
(Date.now() + 8.64e7 * 1).toString() // current time + 1 day | ||
); | ||
document.documentElement.classList.add('banner-dismissed'); | ||
}; | ||
</script> | ||
|
||
<template> | ||
<div ref="el" class="banner"> | ||
<div class="text"> | ||
These docs are of {{ version }}. For docs of the current version visit: | ||
<a href="https://fakerjs.dev/">fakerjs.dev</a> | ||
</div> | ||
|
||
<button type="button" @click="dismiss"> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
viewBox="0 0 20 20" | ||
fill="currentColor" | ||
> | ||
<path | ||
d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" | ||
/> | ||
</svg> | ||
</button> | ||
</div> | ||
</template> | ||
|
||
<style> | ||
.banner-dismissed { | ||
--vp-layout-top-height: 0px !important; | ||
} | ||
html { | ||
--vp-layout-top-height: 88px; | ||
} | ||
@media (min-width: 375px) { | ||
html { | ||
--vp-layout-top-height: 64px; | ||
} | ||
} | ||
@media (min-width: 768px) { | ||
html { | ||
--vp-layout-top-height: 40px; | ||
} | ||
} | ||
</style> | ||
|
||
<style scoped> | ||
.banner-dismissed .banner { | ||
display: none; | ||
} | ||
.banner { | ||
position: fixed; | ||
top: 0; | ||
right: 0; | ||
left: 0; | ||
z-index: var(--vp-z-index-layout-top); | ||
padding: 8px; | ||
text-align: center; | ||
background: #383636; | ||
color: #fff; | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
.text { | ||
flex: 1; | ||
} | ||
a { | ||
text-decoration: underline; | ||
} | ||
svg { | ||
width: 20px; | ||
height: 20px; | ||
margin-left: 8px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
declare const __BANNER__: string | false; | ||
|
||
declare module '*.vue' { | ||
import type { DefineComponent } from 'vue'; | ||
const component: DefineComponent; | ||
export default component; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,22 @@ | ||
import DefaultTheme from 'vitepress/theme'; | ||
import { defineAsyncComponent, h } from 'vue'; | ||
import './index.css'; | ||
|
||
export default DefaultTheme; | ||
export default { | ||
...DefaultTheme, | ||
Layout() { | ||
return h( | ||
DefaultTheme.Layout, | ||
null, | ||
__BANNER__ | ||
? { | ||
'layout-top': () => | ||
h( | ||
defineAsyncComponent(() => import('../components/Banner.vue')), | ||
{ version: __BANNER__ } | ||
), | ||
} | ||
: null | ||
); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.