Skip to content

Commit 0caf8c8

Browse files
committed
move Namecard component from apps/web to packages/ui.
1 parent fd03a66 commit 0caf8c8

File tree

11 files changed

+238
-111
lines changed

11 files changed

+238
-111
lines changed

apps/web/app/components/namecard/Namecard.vue

Lines changed: 0 additions & 76 deletions
This file was deleted.
83.8 KB
Loading
Lines changed: 24 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

packages/ui/components/namecard/Namecard23.vue

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import NamecardAvatar from './NamecardAvatar.vue'
2+
import NamecardAvatar from './NamecardAvatar23.vue'
33
import type { NamecardUser } from '@vuejs-jp/model'
44
import { defineAsyncComponent } from 'vue'
55
@@ -12,12 +12,22 @@ const props = withDefaults(defineProps<NamecardProps>(), {
1212
opacity: 1,
1313
})
1414
15-
const SpBlock = defineAsyncComponent(() => import('../../assets/namecard/2023/pc/block.svg?component'))
15+
const SpBlock = defineAsyncComponent(
16+
() => import('../../assets/namecard/2023/pc/block.svg?component'),
17+
)
1618
const Hook = defineAsyncComponent(() => import('../../assets/namecard/2023/hook.svg?component'))
17-
const Sponsor = defineAsyncComponent(() => import('../../assets/namecard/2023/sponsor.svg?component'))
18-
const NamecardTitle1 = defineAsyncComponent(() => import('../../assets/namecard/2023/title1.svg?component'))
19-
const NamecardTitle2 = defineAsyncComponent(() => import('../../assets/namecard/2023/title2.svg?component'))
20-
const VueFesLogo = defineAsyncComponent(() => import('../../assets/namecard/2023/vuefes_logo.svg?component'))
19+
const Sponsor = defineAsyncComponent(
20+
() => import('../../assets/namecard/2023/sponsor.svg?component'),
21+
)
22+
const NamecardTitle1 = defineAsyncComponent(
23+
() => import('../../assets/namecard/2023/title1.svg?component'),
24+
)
25+
const NamecardTitle2 = defineAsyncComponent(
26+
() => import('../../assets/namecard/2023/title2.svg?component'),
27+
)
28+
const VueFesLogo = defineAsyncComponent(
29+
() => import('../../assets/namecard/2023/vuefes_logo.svg?component'),
30+
)
2131
const SpBg = defineAsyncComponent(() => import('../../assets/namecard/2023/pc/wave.svg?component'))
2232
</script>
2333

packages/ui/components/namecard/Namecard24.stories.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ import Namecard24 from './Namecard24.vue'
44
export default {
55
title: 'namecard/Namecard24',
66
component: Namecard24,
7+
args: {
8+
user: {
9+
display_name: 'jiyuujin',
10+
avatar_url: 'https://i.imgur.com/X0CcoU9.jpg',
11+
role: 'attendee',
12+
},
13+
},
714
}
815

916
const Template: StoryFn<unknown> = (args, { argTypes }) => ({
@@ -16,3 +23,49 @@ const Template: StoryFn<unknown> = (args, { argTypes }) => ({
1623
})
1724

1825
export const Default = Template.bind({})
26+
27+
export const WithParty = Template.bind({})
28+
WithParty.args = {
29+
user: {
30+
display_name: 'jiyuujin',
31+
avatar_url: 'https://i.imgur.com/X0CcoU9.jpg',
32+
role: 'attendee + party',
33+
},
34+
}
35+
36+
export const Speaker = Template.bind({})
37+
Speaker.args = {
38+
user: {
39+
display_name: 'jiyuujin',
40+
avatar_url: 'https://i.imgur.com/X0CcoU9.jpg',
41+
role: 'speaker',
42+
},
43+
}
44+
45+
export const Sponsor = Template.bind({})
46+
Sponsor.args = {
47+
user: {
48+
display_name: 'jiyuujin',
49+
avatar_url: 'https://i.imgur.com/X0CcoU9.jpg',
50+
role: 'sponsor',
51+
},
52+
}
53+
54+
export const Staff = Template.bind({})
55+
Staff.args = {
56+
user: {
57+
display_name: 'jiyuujin',
58+
avatar_url: 'https://i.imgur.com/X0CcoU9.jpg',
59+
role: 'staff',
60+
},
61+
}
62+
63+
export const NoAvatar = Template.bind({})
64+
NoAvatar.args = {
65+
user: {
66+
display_name: '山田 太郎',
67+
avatar_url: '',
68+
role: 'attendee',
69+
},
70+
isPlaceholder: true,
71+
}
Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,74 @@
1+
<script setup lang="ts">
2+
import NamecardAvatar from './NamecardAvatar24.vue'
3+
import type { NamecardUser } from '@vuejs-jp/model'
4+
import { useUserRole } from '@vuejs-jp/composable'
5+
6+
type NamecardProps = {
7+
user: NamecardUser
8+
isPlaceholder?: boolean
9+
}
10+
11+
defineProps<NamecardProps>()
12+
13+
const { backgroundColor } = useUserRole()
14+
</script>
15+
116
<template>
2-
Namecard 2024
17+
<div class="namecard-root">
18+
<NamecardAvatar :user="user" :is-placeholder="isPlaceholder" />
19+
<div
20+
class="namecard-role"
21+
:style="{ '--background-color-role': backgroundColor(user.role ?? 'staff') }"
22+
>
23+
{{ user.role }}
24+
</div>
25+
<div class="namecard-sponsor">
26+
<img src="../../assets/namecard/support.svg" alt="Supported by Stockmark" />
27+
</div>
28+
</div>
329
</template>
30+
31+
<style scoped>
32+
.namecard-root {
33+
width: 23.5rem;
34+
background-color: var(--color-white);
35+
border-radius: calc(var(--unit) * 1.25);
36+
overflow: hidden;
37+
box-shadow: 0px 8px 24px 0px hsla(0, 0%, 0%, 0.239);
38+
border: 1px solid #000;
39+
@media (width <= 480px) {
40+
width: 18rem;
41+
}
42+
}
43+
44+
.namecard-role {
45+
--background-color-role: color-mix(in srgb, var(--color-vue-blue), #000 20%);
46+
font-size: 1.6875rem;
47+
height: 2.625rem;
48+
display: grid;
49+
place-items: center;
50+
font-weight: 700;
51+
text-transform: uppercase;
52+
color: var(--color-white);
53+
background-color: var(--background-color-role);
54+
@media (width <= 480px) {
55+
font-size: 1.3125rem;
56+
height: 2.0625rem;
57+
}
58+
}
59+
60+
.namecard-sponsor {
61+
display: grid;
62+
place-items: center;
63+
height: 3.75rem;
64+
img {
65+
width: 16.25rem;
66+
}
67+
@media (width <= 480px) {
68+
height: 2.8125rem;
69+
img {
70+
width: 12.5rem;
71+
}
72+
}
73+
}
74+
</style>

0 commit comments

Comments
 (0)