Install the module using npm or Yarn:
yarn add @justeat/f-promotions-showcase
npm install @justeat/f-promotions-showcase
You can import it in your Vue SFC like this (please note that styles have to be imported separately):
import PromotionsShowcase from '@justeat/f-promotions-showcase';
import '@justeat/f-promotions-showcase/dist/f-promotions-showcase.css';
export default {
components: {
PromotionsShowcase
}
}
If you are using Webpack, you can import the component dynamically to separate the promotions-showcase
bundle from the main bundle.client.js
:
import '@justeat/f-promotions-showcase/dist/f-promotions-showcase.css';
export default {
components: {
// …
PromotionsShowcase: () => import(/* webpackChunkName: "promotions-showcase" */ '@justeat/f-promotions-showcase')
}
}
There may be props that allow you to customise its functionality.
The props that can be defined are as follows (if any):
Prop | Type | Default | Description |
---|---|---|---|
items |
Array | [] | Array of items that specify what promotional messaging is shown within the component. The component is currently designed to take a maximum of 2 items. The form of an item is as follows below |
An item within the items
prop has the following expected form:
{
illustration: VueComponent, // optional - Vue component definition object or one created through Vue.extend()
title: String, // required - title to be displayed for the item
lines: [ // required - array where elements are either:
'an example line', // strings (given default text styling)
{ // objects - with the styling for that line specified using one of the exported constants
text: 'another example line',
style: STYLE_LINK
}
],
link: { // optional - Depending on config causes the item to be rendered as an `<a>` or a `<button>`. If specified can be a Function (called on click), text (interpreted as a URL) or object specifying link attribute values like so:
href: '/im-a-link', // required
rel: 'noowner',
target: '_blank'
}
}
No events are as yet emitted by the component
Start by cloning the repository and installing the required dependencies:
$ git clone git@github.com:justeat/fozzie-components.git
$ cd fozzie-components
$ yarn
Change directory to the f-promotions-showcase
package:
$ cd packages/components/molecules/f-promotions-showcase
To test all components, run from root directory.
To test only f-promotions-showcase
, run from the ./fozzie-components/packages/components/molecules/f-promotions-showcase
directory.
yarn test
# Note: Ensure Storybook is running when running the following commands
cd ./fozzie-components
yarn storybook:build
yarn storybook:serve-static
yarn test-component:chrome
### Accessibility tests
```bash
yarn test-a11y:chrome