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

iconify周りをupdate #264

Merged
merged 7 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
2,044 changes: 1,838 additions & 206 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"start-mock": "prism mock -p 4010 -d https://raw.githubusercontent.com/traPtitech/traPortfolio/main/docs/swagger/traPortfolio.v1.yaml"
},
"dependencies": {
"@iconify/iconify": "^3.1.1",
"autosize": "^6.0.1",
"axios": "^1.6.8",
"pinia": "^2.1.7",
Expand All @@ -26,7 +25,8 @@
"vue-toastification": "^2.0.0-rc.5"
},
"devDependencies": {
"@iconify/json": "^2.2.224",
"@iconify/vue": "^4.1.2",
"@openapitools/openapi-generator-cli": "^2.7.0",
"@stoplight/prism-cli": "^5.8.1",
"@types/autosize": "^4.0.3",
"@types/jest": "^29.5.12",
Expand All @@ -45,7 +45,6 @@
"ts-morph": "^23.0.0",
"typescript": "^5.5.3",
"vite": "^5.3.2",
"vite-plugin-purge-icons": "^0.10.0",
"vitest": "^1.6.0",
"vue-tsc": "2.0.24"
},
Expand Down
Binary file added src/assets/AtCoder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions src/assets/AtCoder.svg

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/UI/FormInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const handleInput = (event: Event) => {

<template>
<div :class="$style.container" :data-has-anchor="props.hasAnchor">
<div v-if="typeof props.icon !== 'undefined'" :class="$style.iconContainer">
<icon :name="`mdi:${props.icon}`" :icon="$style.icon" />
<div v-if="props.icon !== undefined" :class="$style.iconContainer">
<icon :name="`mdi:${props.icon}`" />
</div>
<input
:class="$style.input"
Expand Down
16 changes: 3 additions & 13 deletions src/components/UI/Icon.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
<script lang="ts" setup>
import { computed } from 'vue'
import { Icon } from '@iconify/vue'

interface Props {
name: string
size?: number
}
const props = withDefaults(defineProps<Props>(), { size: 24 })

const styles = computed(() => ({
height: `${props.size}px`,
width: `${props.size}px`
}))
withDefaults(defineProps<Props>(), { size: 24 })
</script>

<template>
<span
class="iconify"
:data-icon="name"
:style="styles"
:class="$style.icon"
/>
<icon :icon="name" :height="size" :width="size" :class="$style.icon" />
</template>

<style lang="scss" module>
Expand Down
10 changes: 9 additions & 1 deletion src/components/User/UserAccounts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ const shownServices = computed((): Service[] =>
:class="$style.anchor"
:data-has-account="service.url !== null"
>
<icon :name="service.icon" :class="$style.icon" />
<img
v-if="service.notIcon"
:alt="service.name"
:src="service.icon"
:class="$style.icon"
width="24"
height="24"
/>
<icon v-else :name="service.icon" :class="$style.icon" />
</a>
</div>
</template>
Expand Down
7 changes: 5 additions & 2 deletions src/consts/services.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { deepFreeze } from '/@/lib/deepFreeze'
import { AccountType } from '/@/lib/apis'
import AtCoder from '/@/assets/AtCoder.png'

export interface Service<Type extends AccountType = AccountType> {
icon: string
type: Type
notIcon?: boolean
}

export interface ServiceWithName<Type extends AccountType = AccountType>
Expand Down Expand Up @@ -66,8 +68,9 @@ export const services = deepFreeze({
type: AccountType.zenn
},
AtCoder: {
icon: 'atcoder', //アイコンは保留
type: AccountType.atcoder
icon: AtCoder,
type: AccountType.atcoder,
notIcon: true
},
SoundCloud: {
icon: 'mdi:soundcloud',
Expand Down
1 change: 0 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Toast, { POSITION } from 'vue-toastification'
import 'vue-toastification/dist/index.css'

import './index.scss'
import '@purge-icons/generated'

const pinia = createPinia()
const app = createApp(App)
Expand Down
4 changes: 4 additions & 0 deletions src/types/shims-png.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.png' {
const content: string
export default content
}
4 changes: 4 additions & 0 deletions src/types/shims-svg.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const content: string
export default content
}
3 changes: 1 addition & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { defineConfig } from 'vite'
import path from 'path'
import VuePlugin from '@vitejs/plugin-vue'
import PurgeIcons from 'vite-plugin-purge-icons'

const srcPath = path.resolve(__dirname, 'src').replace(/\\/g, '/')

Expand Down Expand Up @@ -34,7 +33,7 @@ export default defineConfig(() => ({
}
}
},
plugins: [VuePlugin(), PurgeIcons()],
plugins: [VuePlugin()],
test: {
globals: true
}
Expand Down