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

feat: add component NeLink #14

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
20 changes: 10 additions & 10 deletions src/components/NeInlineNotification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ const emit = defineEmits(['close', 'primaryClick', 'secondaryClick'])
const isExpandedDetails = ref(false)

const containerKindStyle: { [index: string]: string } = {
info: 'border-indigo-500 bg-indigo-100 dark:border-indigo-400 dark:bg-indigo-900',
warning: 'border-amber-500 bg-amber-100 dark:border-amber-400 dark:bg-amber-700',
error: 'border-rose-500 bg-rose-100 dark:border-rose-400 dark:bg-rose-900',
success: 'border-green-500 bg-green-100 dark:border-green-400 dark:bg-green-900'
info: 'border-indigo-500 bg-indigo-100 dark:border-indigo-300 dark:bg-indigo-900',
warning: 'border-amber-500 bg-amber-100 dark:border-amber-300 dark:bg-amber-700',
error: 'border-rose-500 bg-rose-100 dark:border-rose-300 dark:bg-rose-900',
success: 'border-green-600 bg-green-100 dark:border-green-500 dark:bg-green-900'
}

const iconName: { [index: string]: IconDefinition } = {
Expand Down Expand Up @@ -91,13 +91,13 @@ const descriptionKindStyle: { [index: string]: string } = {
}

const buttonsKindStyle: { [index: string]: string } = {
info: 'bg-indigo-100 text-indigo-800 hover:bg-indigo-200 focus:ring-indigo-600 focus:ring-offset-indigo-100 dark:bg-indigo-900 dark:text-indigo-100 dark:hover:bg-indigo-800 dark:focus:ring-indigo-400 dark:focus:ring-offset-indigo-900',
info: 'ring-indigo-400 dark:ring-indigo-400 bg-indigo-100 text-indigo-800 hover:bg-indigo-200 focus:ring-indigo-600 focus:ring-offset-indigo-100 dark:bg-indigo-900 dark:text-indigo-100 dark:hover:bg-indigo-800 dark:focus:ring-indigo-400 dark:focus:ring-offset-indigo-900',
warning:
'bg-amber-100 text-amber-800 hover:bg-amber-200 focus:ring-amber-600 focus:ring-offset-amber-100 dark:bg-amber-700 dark:text-amber-50 dark:hover:bg-amber-600 dark:focus:ring-amber-400 dark:focus:ring-offset-amber-700',
'ring-amber-500 dark:ring-amber-400 bg-amber-100 text-amber-800 hover:bg-amber-200 focus:ring-amber-600 focus:ring-offset-amber-100 dark:bg-amber-700 dark:text-amber-50 dark:hover:bg-amber-600 dark:focus:ring-amber-400 dark:focus:ring-offset-amber-700',
error:
'bg-rose-100 text-rose-800 hover:bg-rose-200 focus:ring-rose-600 focus:ring-offset-rose-100 dark:bg-rose-900 dark:text-rose-100 dark:hover:bg-rose-800 dark:focus:ring-rose-400 dark:focus:ring-offset-rose-900',
'ring-rose-400 dark:ring-rose-300 bg-rose-100 text-rose-800 hover:bg-rose-200 focus:ring-rose-600 focus:ring-offset-rose-100 dark:bg-rose-900 dark:text-rose-100 dark:hover:bg-rose-800 dark:focus:ring-rose-400 dark:focus:ring-offset-rose-900',
success:
'bg-green-100 text-green-800 hover:bg-green-200 focus:ring-green-600 focus:ring-offset-green-100 dark:bg-green-900 dark:text-green-100 dark:hover:bg-green-800 dark:focus:ring-green-400 dark:focus:ring-offset-green-900'
'ring-green-600 dark:ring-green-600 bg-green-100 text-green-800 hover:bg-green-200 focus:ring-green-600 focus:ring-offset-green-100 dark:bg-green-900 dark:text-green-100 dark:hover:bg-green-800 dark:focus:ring-green-400 dark:focus:ring-offset-green-900'
}

const closeIconKindStyle: { [index: string]: string } = {
Expand Down Expand Up @@ -166,10 +166,10 @@ const closeIconKindStyle: { [index: string]: string } = {
</template>
<!-- buttons -->
<div v-if="primaryButtonLabel || secondaryButtonLabel" class="mt-4">
<div class="-mx-2 -my-1.5 flex">
<div class="-mx-2 flex">
<button
v-if="primaryButtonLabel"
:class="`rounded-md px-2 py-1.5 text-sm font-medium transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 ${
:class="`rounded-md px-2 py-1.5 text-sm font-medium ring-1 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 ${
buttonsKindStyle[props.kind as string]
}`"
type="button"
Expand Down
12 changes: 12 additions & 0 deletions src/components/NeLink.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!--
Copyright (C) 2024 Nethesis S.r.l.
SPDX-License-Identifier: GPL-3.0-or-later
-->
<template>
<a
rel="noreferrer"
class="cursor-pointer text-primary-700 hover:text-primary-800 dark:text-primary-300 dark:hover:text-primary-200"
>
<slot />
</a>
</template>
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export { default as NeTableCell } from '@/components/NeTableCell.vue'
export { default as NeCombobox } from '@/components/NeCombobox.vue'
export { default as NeDropdown } from '@/components/NeDropdown.vue'
export { default as NeCard } from '@/components/NeCard.vue'
export { default as NeLink } from '@/components/NeLink.vue'

// types
export type { NeComboboxOption } from '@/components/NeCombobox.vue'
27 changes: 27 additions & 0 deletions stories/NeLink.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (C) 2024 Nethesis S.r.l.
// SPDX-License-Identifier: GPL-3.0-or-later

import { Meta, StoryObj } from '@storybook/vue3'
import { NeLink } from '../src/main'

const meta: Meta<typeof NeLink> = {
title: 'Visual/NeLink',
component: NeLink,
tags: ['autodocs'],
args: {}
}
export default meta
type Story = StoryObj<typeof meta>

const template = '<NeLink v-bind="args" class="text-sm">Go to Wikipedia</NeLink>'

export const Default: Story = {
render: (args) => ({
components: { NeLink },
setup() {
return { args }
},
template: template
}),
args: {}
}