Skip to content

Commit

Permalink
chore(#111): social links organism (#112)
Browse files Browse the repository at this point in the history
* chore(#111): social links organism

* chore(#111): update social links

---------

Co-authored-by: Brian Gilbert <[email protected]>
Co-authored-by: Stuart Clark <[email protected]>
  • Loading branch information
3 people authored Sep 26, 2023
1 parent 6d4fe30 commit f900c8c
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/components/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,18 @@ export default {
type: String,
default: 'regular'
},
target: {
type: String,
default: undefined
},
text: {
type: String,
default: undefined
},
title: {
type: String,
default: undefined
},
type: {
type: String,
default: undefined
Expand All @@ -84,11 +92,15 @@ export default {
submit: 'input'
}[kind]),
props: ({ component, kind, url }) => ({
props: ({ component, kind, target, title, url }) => ({
button: {},
link: component === 'nuxt-link'
? { to: url || '#' }
: { href: url || '#' },
: {
href: url || '#',
target,
title
},
reset: {},
submit: {}
}[kind]),
Expand Down
53 changes: 53 additions & 0 deletions src/components/SocialLinks.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import CTSocialLinks from './SocialLinks.vue'

export default {
title: 'CivicTheme/Organisms/SocialLinks',
component: CTSocialLinks,
argTypes: {
theme: {
options: ['dark', 'light'],
control: 'select'
}
},
parameters: {
status: {
type: 'beta',
}
}
}

const Template = (args, { argTypes }) => {
return {
props: Object.keys(argTypes),
template: `<CTSocialLinks v-bind="$props" v-on="$props">
<template v-if="$props.default">{{ $props.default }}</template>
</CTSocialLinks>`,
}
}

export const Default = Template.bind({})
Default.storyName = 'Social Links'
Default.args = {
border: true,
theme: 'light',
items: [
{
id: 'facebook',
icon: 'facebook',
link: 'https://facebook.com',
title: 'Facebook'
},
{
id: 'twitter',
icon: 'twitter',
link: 'https://twitter.com',
title: 'Twitter'
},
{
id: 'linkedin',
icon: 'linkedin',
link: 'https://linkedin.com',
title: 'LinkedIn'
}
]
}
55 changes: 55 additions & 0 deletions src/components/SocialLinks.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<template>
<div
class="ct-social-links"
:class="{
[themeClass]: true,
'ct-social-links--with-border': border
}"
>
<CTItemList class="ct-social-links__list" :items="items" type="horizontal">
<template #default="{ item }">
<CTButton
class="ct-social-links__button"
:icon="item.icon"
kind="link"
target="_blank"
:title="item.title"
type="tertiary"
:theme="theme"
:url="item.link"
>
<span class="ct-visually-hidden">(Opens in a new tab/window)</span>
</CTButton>
</template>
</CTItemList>
</div>
</template>

<script>
import ThemeMixin from '../mixins/theme'
export default {
mixins: [ThemeMixin],
props: {
border: {
type: Boolean,
default: false
},
items: {
type: Array,
default: () => ([]),
},
},
data: () => ({
page: 1
}),
watch: {
page() {
this.$emit('page', this.page)
}
}
}
</script>

0 comments on commit f900c8c

Please sign in to comment.