Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6a78bbc

Browse files
committed
feat: base-title component with share
1 parent725a902 commit6a78bbc

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

‎src/components.d.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ declare module '@vue/runtime-core' {
2121
BaseTableItem:typeofimport('./components/ui/table/BaseTableItem.vue')['default']
2222
BaseTableRow:typeofimport('./components/ui/table/BaseTableRow.vue')['default']
2323
BaseThemeToggle:typeofimport('./components/ui/BaseThemeToggle.vue')['default']
24+
BaseTitle:typeofimport('./components/ui/BaseTitle.vue')['default']
2425
BaseWarning:typeofimport('./components/ui/warning/BaseWarning.vue')['default']
2526
BaseWarningContent:typeofimport('./components/ui/warning/BaseWarningContent.vue')['default']
2627
BaseWarningTitle:typeofimport('./components/ui/warning/BaseWarningTitle.vue')['default']

‎src/components/ui/BaseTitle.vue‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<script setup lang="ts">
2+
const { share, isSupported }=useShare()
3+
4+
const props=defineProps<{
5+
title:string
6+
description:string
7+
}>()
8+
9+
function startShare() {
10+
share({
11+
title:props.title,
12+
text:props.description,
13+
url:location.href,
14+
})
15+
}
16+
</script>
17+
18+
<template>
19+
<divclass="not-prose group grid w-full grid-cols-12">
20+
<div
21+
class="doc-title col-span-11 text-[2.25em] text-3xl font-medium text-slate-900 dark:text-white"
22+
>
23+
<slot />
24+
</div>
25+
<div
26+
class="flex w-full justify-end text-slate-400 opacity-0 transition duration-200 group-hover:opacity-100"
27+
>
28+
<button
29+
v-if="isSupported"
30+
class="transition duration-200 hover:text-sky-500"
31+
@click="startShare"
32+
>
33+
<svg
34+
xmlns="http://www.w3.org/2000/svg"
35+
viewBox="0 0 24 24"
36+
fill="currentColor"
37+
class="h-5 w-5"
38+
>
39+
<path
40+
fill-rule="evenodd"
41+
d="M15.75 4.5a3 3 0 11.825 2.066l-8.421 4.679a3.002 3.002 0 010 1.51l8.421 4.679a3 3 0 11-.729 1.31l-8.421-4.678a3 3 0 110-4.132l8.421-4.679a3 3 0 01-.096-.755z"
42+
clip-rule="evenodd"
43+
/>
44+
</svg>
45+
<spanclass="sr-only">Share</span>
46+
</button>
47+
</div>
48+
</div>
49+
</template>
50+
51+
<style scoped>
52+
.doc-title {
53+
font-family: Lexend,ui-sans-serif,system-ui,-apple-system,
54+
BlinkMacSystemFont, Segoe UI, Roboto,Helvetica Neue,Arial, Noto Sans,
55+
sans-serif,'Apple Color Emoji','Segoe UI Emoji', Segoe UISymbol,
56+
'Noto Color Emoji';
57+
}
58+
</style>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp