1.4.1 • Published 1 year ago

@justeat/f-promotions-showcase v1.4.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

f-promotions-showcase

A place for promotional messages to be displayed


npm version CircleCI Coverage Status Known Vulnerabilities


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):

PropTypeDefaultDescription
itemsArray[]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 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

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

Documentation to be completed once module is in stable state.

1.4.1

1 year ago

1.4.0

1 year ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago

0.5.2

3 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.5.1

3 years ago

0.3.0

4 years ago

0.2.0

4 years ago