@justeat/f-promotions-showcase
v1.4.1
Published
Fozzie Promotions Showcase - A place for promotional messages to be displayed
Downloads
45
Maintainers
Keywords
Readme
f-promotions-showcase
A place for promotional messages to be displayed
Usage
Installation
Install the module using npm or Yarn:
yarn add @justeat/f-promotions-showcase
npm install @justeat/f-promotions-showcase
Vue Applications
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')
}
}
Configuration
Props
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 |
Items
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'
}
}
Events
No events are as yet emitted by the component
Development
Start by cloning the repository and installing the required dependencies:
$ git clone [email protected]:justeat/fozzie-components.git
$ cd fozzie-components
$ yarn
Change directory to the f-promotions-showcase
package:
$ cd packages/components/molecules/f-promotions-showcase
Testing
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.
Unit and Integration tests
yarn test
Component and Accessibility Tests
# 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