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

Add Link Component #39

Merged
merged 10 commits into from
Oct 22, 2020
18 changes: 18 additions & 0 deletions src/components/Link/Link.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Link } from '.'

export default {
title: 'Components/Link',
component: Link
}

const Template = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: { Link },
template: '<Link v-bind="$props" />'
})

export const Default = Template.bind({})
Default.args = {
label: 'Software engineer',
destination: 'https://google.es'
}
43 changes: 43 additions & 0 deletions src/components/Link/Link.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<template>
<h5>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this h5

<a class="Link"
mcmontseny marked this conversation as resolved.
Show resolved Hide resolved
:href="destination"
@click="$emit('on-click')">
mcmontseny marked this conversation as resolved.
Show resolved Hide resolved
{{ label }}
</a>
</h5>
</template>

<script>
export default {
name: 'Link',
props: {
label: {
type: String,
required: true
},
destination: {
type: String,
required: true
}
},
emits: ['on-click']
}
</script>

<style scoped lang="scss">
.Link {
font-family: "Montserrat",Helvetica,Arial,sans-serif;
font-weight: 700;
line-height: 1.2;
text-transform: uppercase;
letter-spacing: 0.1em;
color: #ff7473;
text-decoration: none;

&:focus, &:hover {
color: #ff2827;
text-decoration: underline;
}
}
</style>
1 change: 1 addition & 0 deletions src/components/Link/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as Link } from './Link.vue'
13 changes: 11 additions & 2 deletions src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,31 @@
<template>
<div>
<Header />
<Button
<Button
label="Click me!"
@on-click="onButtonClick"
/>
<Link
label="Software engineer"
destination="https://google.es"
@on-click="onLinkClick"
/>
</div>
</template>

<script>
import { Button } from '../components/Button'
import { Header } from '../components/Header'
import { Link } from '../components/Link'

export default {
components: { Button, Header },
components: { Button, Header, Link },
methods: {
onButtonClick () {
alert('Button have been clicked')
},
onLinkClick () {
alert('Link have been clicked')
}
}
}
Expand Down