diff --git a/packages/vue-vocabulary/.storybook/main.js b/packages/vue-vocabulary/.storybook/main.js index 8a963c0c2..07773a5be 100644 --- a/packages/vue-vocabulary/.storybook/main.js +++ b/packages/vue-vocabulary/.storybook/main.js @@ -1,11 +1,8 @@ module.exports = { - stories: [ - './meta/*.stories.*', - '../src/**/*.stories.*' - ], + stories: ["./meta/*.stories.*", "../src/**/*.stories.*"], addons: [ - '@storybook/addon-essentials', - '@storybook/addon-docs', - '@storybook/addon-a11y' - ] -} + "@storybook/addon-docs", + "@storybook/addon-essentials", + "@storybook/addon-a11y", + ], +}; diff --git a/packages/vue-vocabulary/.storybook/meta/usage.stories.mdx b/packages/vue-vocabulary/.storybook/meta/usage.stories.mdx index 9c91083d4..03b9abfbe 100644 --- a/packages/vue-vocabulary/.storybook/meta/usage.stories.mdx +++ b/packages/vue-vocabulary/.storybook/meta/usage.stories.mdx @@ -46,14 +46,14 @@ Then in the component containing Vocabulary components, import the required comp components using Vue.component for global registration or in the components dictionary within your component definition. ```js -import { Header, Footer, Locale } from '@creativecommons/vue-vocabulary' +import { VHeader, Footer, Locale } from '@creativecommons/vue-vocabulary' export default { components: { - Header, + VHeader, Footer, Locale - } + }, ... } ``` @@ -70,7 +70,7 @@ And your template can go like this. ```html
-
+
``` diff --git a/packages/vue-vocabulary/src/index.js b/packages/vue-vocabulary/src/index.js index b8b32b295..e5fc4dc9a 100644 --- a/packages/vue-vocabulary/src/index.js +++ b/packages/vue-vocabulary/src/index.js @@ -15,8 +15,10 @@ import Tab from './layouts/Tabs/Tab' import Tabs from './layouts/Tabs/Tabs' import AppModal from './patterns/AppModal/AppModal' import Footer from './patterns/Footer/Footer' -import Header from './patterns/Header/Header' import Locale from './patterns/Locale/Locale' +import NavDropdown from './patterns/VHeader/NavDropdown' +import NavItem from './patterns/VHeader/NavItem' +import VHeader from './patterns/VHeader/VHeader' import SlotRenderer from './utils/SlotRenderer/SlotRenderer' // Export individual components @@ -31,8 +33,10 @@ export { Tabs, AppModal, Footer, - Header, Locale, + NavDropdown, + NavItem, + VHeader, SlotRenderer } @@ -49,8 +53,10 @@ export default { Vue.component('Tabs', Tabs) Vue.component('AppModal', AppModal) Vue.component('Footer', Footer) - Vue.component('Header', Header) Vue.component('Locale', Locale) + Vue.component('NavDropdown', NavDropdown) + Vue.component('NavItem', NavItem) + Vue.component('VHeader', VHeader) Vue.component('SlotRenderer', SlotRenderer) } } diff --git a/packages/vue-vocabulary/src/patterns/Header/Header.vue b/packages/vue-vocabulary/src/patterns/Header/Header.vue deleted file mode 100644 index a3416d902..000000000 --- a/packages/vue-vocabulary/src/patterns/Header/Header.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/packages/vue-vocabulary/src/patterns/VHeader/NavDropdown.vue b/packages/vue-vocabulary/src/patterns/VHeader/NavDropdown.vue new file mode 100644 index 000000000..2e671eaf8 --- /dev/null +++ b/packages/vue-vocabulary/src/patterns/VHeader/NavDropdown.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/packages/vue-vocabulary/src/patterns/VHeader/NavItem.vue b/packages/vue-vocabulary/src/patterns/VHeader/NavItem.vue new file mode 100644 index 000000000..ac0584810 --- /dev/null +++ b/packages/vue-vocabulary/src/patterns/VHeader/NavItem.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/packages/vue-vocabulary/src/patterns/VHeader/VHeader.stories.js b/packages/vue-vocabulary/src/patterns/VHeader/VHeader.stories.js new file mode 100644 index 000000000..32bdad50b --- /dev/null +++ b/packages/vue-vocabulary/src/patterns/VHeader/VHeader.stories.js @@ -0,0 +1,54 @@ +import VHeader from "./VHeader"; +import ChooserLogo from "@creativecommons/vocabulary/assets/logos/products/chooser.svg?inline"; +import NavItem from "./NavItem"; +import NavDropdown from "./NavDropdown"; +import { addDescription } from "../../utils/addDescription"; + +export default { + title: "Elements/VHeader", + component: VHeader, +}; + +let menuItems = ` + + + + + +`; + +const Template = (args, { argTypes }) => ({ + props: Object.keys(argTypes), + components: { VHeader, NavItem, NavDropdown }, + template: ``, +}); + +export const Default = Template.bind({}); + +export const ChooserHeader = (args, { argTypes }) => ({ + props: Object.keys(argTypes), + components: { VHeader, NavItem, ChooserLogo }, + template: ` + +`, +}); +addDescription( + ChooserHeader, + "This is a sample header for the Chooser page. It uses `` svg component as the logo, and one `` component." +); + +export const IntlHeader = (args, { argTypes }) => ({ + props: Object.keys(argTypes), + components: { VHeader, NavItem, ChooserLogo }, + template: ` +`, +}); +addDescription( + IntlHeader, + "When using i18n, you should pass translated strings to the header" +); diff --git a/packages/vue-vocabulary/src/patterns/VHeader/VHeader.vue b/packages/vue-vocabulary/src/patterns/VHeader/VHeader.vue new file mode 100644 index 000000000..6add54ee5 --- /dev/null +++ b/packages/vue-vocabulary/src/patterns/VHeader/VHeader.vue @@ -0,0 +1,80 @@ + + + +