Skip to content

Commit

Permalink
feat: update icons
Browse files Browse the repository at this point in the history
  • Loading branch information
oeyoews committed Jul 21, 2024
1 parent d566118 commit 8ec8d6f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 27 deletions.
2 changes: 0 additions & 2 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export {}
declare module 'vue' {
export interface GlobalComponents {
ElButton: typeof import('element-plus/es')['ElButton']
ElCol: typeof import('element-plus/es')['ElCol']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
Expand All @@ -19,7 +18,6 @@ declare module 'vue' {
ElLink: typeof import('element-plus/es')['ElLink']
ElOption: typeof import('element-plus/es')['ElOption']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElRow: typeof import('element-plus/es')['ElRow']
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
Expand Down
45 changes: 20 additions & 25 deletions entrypoints/sidepanel/components/SearchPage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<!-- history -->
<script setup lang="ts">
import { LogosChrome, LogosMicrosoftEdge } from '@/utils/icons';
import {
MaterialSymbolsHouseOutlineRounded,
MaterialSymbolsSearchRounded,
LogosChrome,
LogosBing,
} from '@/utils/icons';
const props = defineProps<{
port: number;
}>();
Expand All @@ -13,33 +18,19 @@ const engines = [
{
name: 'Google',
value: 'https://www.google.com/search?q=',
icon: 'LogosChrome',
icon: LogosChrome,
},
{
name: 'Bing',
value: 'https://www.bing.com/search?q=',
icon: 'LogosMicrosoftEdge',
icon: LogosBing,
},
];
const getIcon = (name: string) => {
switch (name) {
case 'Google':
return LogosChrome;
case 'Bing':
return LogosMicrosoftEdge;
default:
return LogosChrome;
}
};
] as const;
const getCurrentIcon = (value: string) => {
const icon = engines.find((engine) => engine.value === value)?.icon;
if (icon === 'LogosChrome') {
return LogosChrome;
} else {
return LogosMicrosoftEdge;
}
return engines.find((engine) => engine.value === value)?.icon;
};
const searchEngine = ref(engines[0].value);
const openweb = (url: string) => {
if (!url.startsWith('http')) {
Expand Down Expand Up @@ -78,19 +69,23 @@ const openweb = (url: string) => {
:label="engine.name"
:value="engine.value">
<div class="flex items-center gap-2">
<component :is="getIcon(engine.name)" />
<component :is="engine.icon" />
{{ engine.name }}
</div>
</el-option>
</el-select>
</template>
</el-input>
<el-button @click="openweb(targetLink)">搜索</el-button>
<el-button
@click="openweb(targetLink)"
class="aspect-square">
<material-symbols-search-rounded />
</el-button>
<el-button
@click="$emit('goHome')"
class="!ml-1"
>主页</el-button
>
class="!ml-1 aspect-square">
<material-symbols-house-outline-rounded />
</el-button>
</div>
</el-form-item>
</el-form>
Expand Down
4 changes: 4 additions & 0 deletions utils/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ export { default as GameIconsHole } from '~icons/game-icons/hole';

export { default as LogosChrome } from '~icons/logos/chrome';
export { default as LogosMicrosoftEdge } from '~icons/logos/microsoft-edge';
export { default as LogosBing } from '~icons/logos/bing';

export { default as MaterialSymbolsHouseOutlineRounded } from '~icons/material-symbols/house-outline-rounded';
export { default as MaterialSymbolsSearchRounded } from '~icons/material-symbols/search-rounded';

0 comments on commit 8ec8d6f

Please sign in to comment.