# Components

# Introduction

Components are located in ./site/src/components and required to be individually imported using ES6 imports.

NAMING CONVENTION

Please add a Fon prefix to component's name

import FonComponentName from '/path/to/ComponentName'

Some components title will show a duplicated badge. This means the original component can not be used in this documentation context. It usually happens when components refer to Vuex or uses third-party libraries.

Duplicated components will be located in ./docs/.vuepress/components and have the Fon prefix included to the file name. Keep in mind their behaviours might slightly differ to the components used in production.

# Accordions duplicated

Item

Lorem ipsum dolor sit amet consectetur adipisicing elit...
<FonAccordion>
  <FonAccordionItem>
    <p slot="title">Item</p>
    <div>Lorem ipsum dolor sit amet consectetur adipisicing elit...</div>
  </FonAccordionItem>
</FonAccordion>

WARNING

Accordion and AccordionItem are required to work correctly

# AccordionItem props

prop type required default description
openedBooleanfalsefalse-

# Author

Zinedine Zidane Find Out Now Market Research

Slot content

<FonAuthor
  :author='{
    "name": "Zinedine Zidane",
    "avatar": "https://pbs.twimg.com/profile_images/378800000595529455/73fb09b52ed955712b4c5235525ab643.jpeg"
  }'
  inline
>
  <p>Slot content</p>
</FonAuthor>

The author.name will be used as an alternative text to the image.

prop type required default description
inlineBooleanfalsefalseDetermine where to display the name
authorObjecttrue--
pictureBooleanfalsetrue-

# Back button

<FonBackButton/>
prop type required default description
labelStringfalseBack-

Will execute $router.go(-1) on click.

# Bar duplicated

A

0%

B

static text

<FonBar
  label="A"
  :theme="{ color: 'info', border: 'rounded' }"
  :percentage="{ value: 75 }"
/>

<FonBar
  label="B"
  :theme="{ color: 'danger', border: 'rounded' }"
  :percentage="{ value: 45, shownValue: 'static text' }"
/>

prop type required default description
labelStringfalse--
themeObjecttrue--
└ colorStringtrue-Options: default, secondary, info, warning, danger
└ borderStringtrue-Options: rounded
percentageObjecttrue--
└ valueNumbertrue--
└ shownValueStringfalse-Will replace actual percentage number with this value if present

# Card

Title

Lorem ipsum

Footer
<FonCard squared v-backgroundColor="{ background: '#eee' }">
  <div class="c-card--header" slot="header"></div>
  <div class="c-card--body" slot="body" v-backgroundColor="{ background: '#ffffff' }">
    <article class="c-card--inner">
      <h1 class="h5">Title</h1>
      <p>Lorem ipsum</p>
      <footer>Footer</footer>
    </article>
  </div>
</FonCard>

WARNING

To use v-backgroundColor, include @/directives/backgroundColor.js as a directive in the vue instance.

prop type required default description
squaredBooleanfalsefalseTo force square ratio

# Input number duplicated

sample: 0
<FonInputNumber
  :start="1"
  :max="100"
/>
prop type required default description
placeholderString | Numberfalse200-
minNumberfalse0-
maxNumberfalse100-
stepNumberfalse1-
startNumberfalse0-
labelStringfalse-
isErrorBooleanfalsefalse-
widthNumberfalse160-
simpleBooleanfalsefalse-

# Loader

<FonLoader/>
prop type required default options
loadingBooleanfalsetrue-
sizeStringfalsenullxs
themeStringfalsenulllight

TIP

@todo: More size & theme support

# Message

Lorem ipsum dolor sit amet?

<FonMessage>
  <p>Lorem ipsum dolor sit amet?</p>
</FonMessage>

# Pagination duplicated

<FonPagination
  :count="pageCount"
  :range="pageRange"
  :index="pageIndex"
  @onClicked="onClicked"
/>
prop type required default description
countNumberfalse1Number of pages
rangeNumberfalse3Range of item displayed
indexNumberfalse1Current page
onClickedMethodfalsefalseCallback function

FonPagination is a wrapper component to avoid slots duplication and to share unscoped CSS. It requires vuejs-paginate (opens new window)

TIP

Use Router params to create a proper navigation system

<FonPagination
  :index="pageId"
  @onClicked="onClicked"
/>

<script>
...
export default {
  ...
  computed: {
    pageId() {
      return this.$route.params.page_id
    }
  },
  methods: {
    ...mapActions(['fetchData']),
    onClicked(index) {
      this.$router.push({
        name: 'ROUTE_NAME',
        params: {
          page_id: index
        }
      }, this.fetchData(index))
    }
  }
}
</script>

# Progress bar

<FonProgressBar
  :percentage="50"
  type="secondary"
/>
prop type required default options
percentageNumberfalse0-
typeStringfalseprimaryprimary, secondary or danger
liveAnimationBooleanfalsefalse-

# Quote

These numbers support our suspicions! Birilliant!

<FonQuote
  quote="These numbers support our suspicions! Birilliant!"
  author="Mark Nicholls - Heavenly"
  link="https://findoutnow.co.uk"
/>
prop type required description
quoteStringtrue-
authorStringfalse-
linkString || URLfalseTo make to author name clickable

# Select duplicated

<FonSelect
  :options="[{
    id: 0,
    label: 'A',
    value: 'a'
  },
  {
    id: 1,
    label: 'B',
    value: 'b'
  }]"
/>
prop type required default description
labelStringfalsenullTrigger copy
startIndexNumberfalse0Used for multi select
optionsArraytrue--

WARNING

The original component uses v-blur directive to auto-close on blur event.

<template>
  <div class="c-select" v-blur="onBlur">...</div>
</template>

<script>
import blur from '@/directives/blur.js'

export default {
  directives: {
    blur
  },
  ....
  methods: {
    onBlur() {
      // blur event callback
    }
  }
}
</script>

# Selector duplicated

Active: car-owners
<FonSelector
  :datas="[
    {
      id: 'a',
      label: 'A',
      icon: 'a',
      max: 123
    },
    ...
  ]"
/>
prop type required default description
datasArraytrue--
maxNumberfalse--
iconsBooleanfalse--
activeString || Numberfalsenull-

@todo

Multiple selection & Image support

# Social sharers

<FonSocialSharers
  :networks="['twitter', 'linkedin', 'facebook']"
  inline
/>
prop type required default description
networksArrayfalse-twitter and facebook
inlineBooleanfalsefalse-

WARNING

Make sure to update meta tags

# Stack

  • A
  • B
  • C
25%
<FonStack
  :items="['A', 'B', 'C']"
  :percentage="25"
/>
prop type required default description
itemsArraytrue-Array of Stack items
percentageNumberfalse0-

# Step tracker

<FonStepTracker
  :steps="[
    {
      name: 'A',
      route: '/',
      clickable: true
    },
    ...
  ]"
/>
prop type required default description
stepsObject || Arraytrue--

# Tabs duplicated

<FonTabs
  :tabs="[
    {
      route: 'one',
      label: 'One'
    },
    ...
  ]"
/>
prop type required default description
tabsArraytrue--
animatedbooleanfalsefalse-
disabledbooleanfalsefalse-

WARNING

The original Tabs component watches the route to handle active state

# Title

My title example

<FonTitle
  title="My title example"
/>
prop type required default description
titleStringtrue--

# Toaster

<FonToaster
  state="warning"
  type="pill"
  :delay="0"
>
  <span class="h-bold">Slot</span> content
</FonToaster>
prop type required default options description
typeStringfalsealertalert, pill-
stateStringfalseinfoinfo, success, warning, danger-
positionStringfalsetoptop, bottom-
directionStringfalseupup, down-
delayNumberfalse500--
inViewBooleanfalsefalse-If true animation will start when Toaster is visible
animatedBooleanfalsetrue--

# Toggle duplicated

is checked: true
<FonToggle
  id="toggleID"
  label="My toggle"
  :checked="isChecked"
  @onToggled="toggleHandler"
/>
prop type required default description
idStringtrue--
labelStringfalse--
checkedBooleanfalsefalse-

A method toggle() is attached to the click event and emits onToggled, passing the component id

<script>
export default {
  ...
  props: {
    ...
    id: {
      type: String,
      required: true
    }
  },
  methods: {
    toggle() {
      this.$emit('onToggled', this.id)
    }
  }
}
</script>
Last Updated: 2/24/2021, 1:56:28 PM