Skip to content

Commit

Permalink
Updated Link component
Browse files Browse the repository at this point in the history
  • Loading branch information
ebkr committed Nov 8, 2024
1 parent 67fa1c7 commit 14f580b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Progress from './Progress.vue';
import ExpandableCard from './ExpandableCard.vue';
import Modal from './Modal.vue';
import ModalCard from './ModalCard.vue';
import Link from './Link.vue';
import Link from './v2/Link.vue';
import DeferredInput from './DeferredInput.vue';

export {
Expand Down
43 changes: 43 additions & 0 deletions src/components/v2/Link.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<template>
<component :is="tag" v-if="target === 'file'" @click="selectFile()" class='c-link' data-semantic="file-selection">
<slot></slot>
</component>
<component :is="tag" v-else-if="target != null" @click="openLink()" class='c-link' data-semantic="external-link">
<slot></slot>
</component>
<component :is="tag" v-else class='c-link' data-semantic="visual-indicator">
<slot></slot>
</component>
</template>

<script lang="ts" setup>
import LinkProvider from '../../providers/components/LinkProvider';
interface LinkProps {
url: string;
target?: string;
tag: string;
}
const linkProps = withDefaults(defineProps<LinkProps>(), {
tag: "a"
})
function openLink() {
LinkProvider.instance.openLink(linkProps.url);
}
function selectFile() {
LinkProvider.instance.selectFile(linkProps.url);
}
</script>

<style lang="scss" scoped>
.c-link {
color: var(--v2-link-text-color);
&:focus, &:hover, &:active {
color: var(--v2-link-active-text-color);
}
}
</style>
3 changes: 3 additions & 0 deletions src/css/v2/_initial.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@
--v2-warning-background-color: #ffe08a;
--v2-warning-text-color: #222;
--v2-warning-subtitle-text-color: #272727;

--v2-link-text-color: #3f8ecf;
--v2-link-active-text-color: white;
}

0 comments on commit 14f580b

Please sign in to comment.