Skip to content

Commit

Permalink
chore(#111): social links organism
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianGilbert committed Sep 26, 2023
1 parent 4d91d04 commit 73660f3
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
}"
data-component-name="button"
data-button="true"
:target="target"
:title="title"
v-bind="props"
>
<CTIcon
Expand Down Expand Up @@ -62,10 +64,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 Down
34 changes: 34 additions & 0 deletions src/components/SocialLinks.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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: {'Facebook': 'https://facebook.com', 'Twitter': 'https://twitter.com', 'LinkedIn': 'https://linkedin.com'}
}
57 changes: 57 additions & 0 deletions src/components/SocialLinks.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<template>
<div :class="`ct-social-links ${themeClass} ${border ? 'ct-social-links--with-border': ''}`">
<ul class="ct-item-list ct-item-list--horizontal ct-item-list--regular ct-social-links__list">

<li
v-for="(link, title) in items"
:key="link"
class="ct-item-list__item"
>
<CTButton
class="ct-icon ct-button__icon"
:icon="title.toLowerCase()"
kind="link"
target="_blank"
:title="title"
type="tertiary"
:url="link"
>
<span class="ct-visually-hidden">(Opens in a new tab/window)</span>
</CTButton>
</li>
</ul>
</div>
</template>

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

0 comments on commit 73660f3

Please sign in to comment.