1.3.658 • Published 6 years ago

bf-components v1.3.658

Weekly downloads
34
License
-
Repository
-
Last release
6 years ago

Bf Vue Components

npm package for custom Vue.js components used by Big Fish marketing for branded websites.

Build Setup

# install verdaccio globally
npm install -g verdaccio

# serve packages with
verdaccio

# Set your registry for publishing and pulling packages
npm set registry http://localhost:4873/

Base Components


SectionHero

import { SectionHero } from 'bf-components'
<SectionHero className="custom-class-name" idName="custom-id-name" :injectStyle="customStyleObject" :innerDivStyle="customStyleObject">
    <div slot="slot-logo">
        Add markup for logo section here
    </div>
    <div slot="slot-cta">
        Add markup for cta section here
    </div>
    <div slot="slot-tagline">
        Add markup for tagline section here
    </div>
    <div slot="slot-footer">
        Add markup for anything you'd like aligned bottom in the hero section
    </div>
</SectionHero>
PropsTypeDefaultDescription
classNameStringn/aAllows user to add a custom class name to the root of the component
idNameStringn/aAllows user to add a custom id name to the root of the component
injectStyleObjectn/aAllows user to add or override default inline styles on the root of the component
innerDivStyleObjectn/aAllows user to add or override default inline styles to the inner div of the component

This section will automatically center the inner div that contains the logo, cta, and tagline. The tagline slot and footer slot is optional, but the other two are required. You may add any raw html markup or VUE component markup in these slot sections.

SectionSplit

import { SectionSplit } from 'bf-components'
      <SectionSplit className="custom-class-name" idName="custom-id-name" wrap="reverse" :injectStyle="customStyleObject" backgroundImage="image-url.jpg" :lazyLoadWithScrollPosition="currentWindowScrollPosition" lazyLoadOffset="250">
        <div slot="slot-left">
            Add markup for left side content here
        </div>
        <div slot="slot-right">
            Add markup for right side content here
        </div>
      </SectionSplit>
PropsTypeDefaultDescription
classNameStringn/aAllows user to add a custom class name to the root of the component
idNameStringn/aAllows user to add a custom id name to the root of the component
injectStyleObjectn/aAllows user to add or override default inline styles on the root of the component
wrapString'default'Accepts default or reverse. Dictates the wrap order behavior of the section
isDefaultStylesEnabledBooleantrueEnables or disables the default styling inlined on the component
backgroundImageStringn/aOptional image path to background image for the section
lazyLoadWithScrollPositionNumbern/aIf the current window scroll position is passed in, then it enables lazy load on the background image for this section.
lazyLoadOffsetNumber250Determines the scroll offset position for when images get loaded.

SectionFull

import { SectionFull } from 'bf-components'
<SectionFull
	className="custom-class-name"
    idName="custom-id-name"
    :injectStyle="customStyleObject"
    :backgroundImage="image-url.jpg"
    :lazyLoadWithScrollPosition="currentWindowScrollPosition"
    lazyLoadOffset="250"
>
    Whatever you put in here will be in a full width section
</SectionFull>
PropsTypeDefaultDescription
classNameStringn/aAllows user to add a custom class name to the root of the component
idNameStringn/aAllows user to add a custom id name to the root of the component
injectStyleObjectn/aAllows user to add or override default inline styles on the root of the component
isDefaultStylesEnabledBooleantrueEnables or disables the default styling inlined on the component
backgroundImageStringn/aOptional image path to background image for the section
lazyLoadWithScrollPositionNumbern/aIf the current window scroll position is passed in, then it enables lazy load on the background image for this section.
lazyLoadOffsetNumber250Determines the scroll offset position for when images get loaded.

BannerSmartApp

import {BannerSmartApp } from 'bf-components'
<BannerSmartApp
    device="currentUserDevice"
    appName="Name of App"
    companyName="Name of App Developer"
    androidRating="5"
    iosRating="5"
    :mobileOnly="true"
    googleStoreLink="http://www.link-to-google-store-download.com"
    appStoreLink="http://www.link-go-app-store-download.com"
    androidAppIcon="./images/android-app-icon.png"
    iosAppIcon="./images/ios-app-icon.png"
    :triggerResize="handleResize"
>
</BannerSmartApp>
PropsTypeDefaultDescription
deviceString'desktop'The detected device of the current user. Usually stored in state.
appNameString'This Game'The name of the app
companyNameString'Big Fish Games'The name of the company that made the app
androidRatingNumber5The star rating of the app in the Google Play Store (out of 5)
iosRatingNumber5The star rating of the app in the iOS App Store (out of 5)
mobileOnlyBooleantrueDictates whether or not the smart app banner displays on mobile only
googleStoreLinkString'www.google.com'The download link for the app in the Google Play Store
appStoreLinkString'www.apple.com'The download link for the app in the Apple App Store
androidAppIconStringn/aThe image link for the Android App Icon
iosAppIconStringn/aThe image link for the iOS App Icon
triggerResizeFunctionn/aFires when the modal closes so the page can reload with new dimensions

ButtonDefault

import { ButtonDefault } from 'bf-components'
<ButtonDefault
    className="custom-class-name"
    idName="custom-id-name"
    injectStyle="customStyleObject"
    onClick="CustomFunction()"
    hyperlink="http://www.link-to-site.com"
    text="Button Display Text"
    buttonColor="Default Button Color"
    buttonHoverColor="Hover Button Color"
    animation="bounce"
    imageLink="../image-url.png"
    :lazyLoadWithScrollPosition="currentWindowScrollPosition"
    lazyLoadOffset="250"
>
</ButtonDefault>
PropsTypeDefaultDescription
classNameStringn/aAllows user to add a custom class name to the root of the component
idNameStringn/aAllows user to add a custom id name to the root of the component
injectStyleObjectn/aAllows user to add or override default inline styles on the root of the component
onClickFunctionn/aAllows user to add a custom onClick handler to the button
hyperlinkStringn/aSets the hyperlink for the button
textStringn/aSets the text that appears on a non-image button
buttonColorStringn/aSets the background color of a non-image button
buttonHoverColorStringn/aSets the hover color of a non-image button
animationStringn/aAccepts bounce. Determines the css hover animation of the button
imageLinkStringn/aAccepts an image filepath and turns the button into an image button
isDefaultStylesEnabledBooleantrueEnables or disables the default styling inlined on the component
lazyLoadWithScrollPositionNumbern/aIf the current window scroll position is passed in, then it enables lazy load on the button Image.
lazyLoadOffsetNumber250Determines the scroll offset position for when images get loaded.

Currently the only animation available for button is 'bounce'.

IconDefault

import { IconDefault } from 'bf-components'
<IconDefault
    className="custom-class-name"
    idName="custom-id-name"
    injectStyle="customStyleObject"
    imageLink="../image-url.png"
    hyperlink="http://www.link-to-site.com"
    imageAlt="Alt text for the icon image"
    text="Text to display with the icon"
    display="block"
    animation="bounce"
    iconSize="small"
    iconHeader="Header Info"
    iconPosition="after"
    responsive="true"
    :lazyLoadWithScrollPosition="currentWindowScrollPosition"
    lazyLoadOffset="250"
>
</IconDefault>
PropsTypeDefaultDescription
classNameStringn/aAllows user to add a custom class name to the root of the component
idNameStringn/aAllows user to add a custom id name to the root of the component
injectStyleObjectn/aAllows user to add or override default inline styles on the root of the component
imageLinkStringn/aAccepts an image filepath for the icon
hyperlinkStringn/aSets the hyperlink for the icon
imageAltStringn/aSets the alt-text for the icon image
textStringn/aText that appears next to the icon
displayString'inline'Accepts block or inline. Determines how the icon and text are displayed.
animationStringn/aAccepts bounce. Determines the css hover animation of the icon.
iconSizeString'medium'Accepts small, medium, large, or xlarge. Determines icon size.
iconPositionString'before'Accepts before or after. Determines icon position relative to text.
iconHeaderStringn/aAdds text to the heading of the icon.
responsiveBooleantrueDictates whether or not icon behaves responsively when display is inline.
isDefaultStylesEnabledBooleantrueEnables or disables the default styling inlined on the component.
lazyLoadWithScrollPositionNumbern/aIf the current window scroll position is passed in, then it enables lazy load on the icon Image.
lazyLoadOffsetNumber250Determines the scroll offset position for when images get loaded.

FrameDefault

import { FrameDefault } from 'bf-components'
<FrameDefault
    className="custom-class-name"
    idName="custom-id-name"
    injectStyle="customStyleObject"
    assetRoot="path/to/dist/assets/"
    contentLink="https:/link-to-content.com"
    frame="iphone-white"
    :isDefaultStylesEnabled="true"
    :lazyLoadWithScrollPosition="currentWindowScrollPosition"
    lazyLoadOffset="250"
    isModalEnabled="true"
>
</FrameDefault>
PropsTypeDefaultDescription
classNameStringn/aAllows user to add a custom class name to the root of the component
idNameStringn/aAllows user to add a custom id name to the root of the component
injectStyleObjectn/aAllows user to add or override default inline styles on the root of the component
assetRootStringn/aPath to the dist assets folder
contentLinkStringn/aFile path to the image or video to be rendered in the frame
frameString'iphone-white'Accepts iphone-white, iphone-black, ipad, or galaxy-black. Determines frame image.
isDefaultStylesEnabledBooleantrueEnables or disables the default styling inlined on the component
lazyLoadWithScrollPositionNumbern/aIf the current window scroll position is passed in, then it enables lazy load on the frame.
lazyLoadOffsetNumber250Determines the scroll offset position for when images get loaded.
isModalEnabledBooleanfalseControls whether a modal will display when the frame is clicked with a lightbox of the contents.

ModalDefault

import { ModalDefault } from 'bf-components'
<ModalDefault
    className="custom-class-name"
    idName="custom-id-name"
    assetRoot="path-to-asset-root"
    toggleModalActiveFn="toggleModalActiveFn"
    isModalActive="isModalActive"
    injectStyle="customStyleObject"
    bgColor="white"
    borderColor="#00487c"
>
    Add the HTML Markup for inside the modal here!
</ModalDefault>
PropsTypeDefaultDescription
classNameStringn/aAllows user to add a custom class name to the root of the component
idNameStringn/aAllows user to add a custom id name to the root of the component
injectStyleObjectn/aAllows user to add or override default inline styles on content of the component
bgColorString"white"Determines the background color of the modal
borderColorString"#00487c"Determines the top border color for the modal
isModalActiveBooleanfalseTriggers the modal's visiblity when true. See the modalMixin
toggleModalActiveFnFunctionn/aFunction that handles modal visiblity. See the modalMixin
isDefaultStylesEnabledBooleantrueEnables or disables the default styling inlined on the component.

Note that you should include the modalMixin wherever you include the DefaultModal component. Unless you want custom modal event handling.

SliderDefault

import { SliderDefault } from 'bf-components'
<template>
  <SliderDefault
      :slides="slideImages"
      :customProps="{
          slidesToShow: slidesToShow,
          centerMode: true,
          slidesToScroll: 2,
          dots: false
       }"
   >
   </SliderDefault>
 </template>
<script>
// Slide items can be string templates
  const slideItem1 = {
      index: 0,
      content: `<div class="some-class">content here</div>`
  }

// Or Slide Items can be full components
  const slideItem2 = {
    index: 1,
    component: SomeComponent,
    props: {
        some_component_prop: value_for_prop
      }
  }

  const slideImages = [slideItem1, slideItem2]
</script>

Slider Component Options

PropsTypeDefaultDescription
slidesArrayn/aAn Array of slide objects
customPropsObjectn/aOverrides the default slider props. See below:

Slider Custom Props

PropsTypeDefaultDescription
classNameStringn/aDefines custome classname for slider
autoplayBooleanfalseDetermines whether slider autoplays
centerModeBooleanfalseCenters the slides and displays preview of next and previous slides.
dotsBooleantrueDetermines whether guide dots should display
draggableBooleantrueToggles draggability of the slider.
easingString'linear'Determines easing animation of the slider
edgeFrictionInteger0.35Adds friction to the edge of the slider
infiniteBooleantrueDetermines whether the slider scrolls forever or not
initialSlideInteger0Determines default slide number to show on load
slidesToShowInteger1Determines number of slides to show at a time
slidesToScrollInteger1Determines number of slides to scroll at a time
speedInteger500Determines speed of slider scroll

ContainerFlex

import { ContainerFlex } from 'bf-components'
<ContainerFlex
    className="custom-class-name"
    idName="custom-id-name"
    alignItems="center"
    flexDirection="row"
    justifyContent="center"
    :injectStyle="customStyleObject"
    :backgroundImage="image-url.jpg"
    :lazyLoadWithScrollPosition="currentWindowScrollPosition"
    lazyLoadOffset="250"
>
    <div slot="slot-content">
        Whatever you put in here will be centered in a flexbox!
    </div>
</ContainerFlex>
PropsTypeDefaultDescription
classNameStringn/aAllows user to add a custom class name to the root of the component
idNameStringn/aAllows user to add a custom id name to the root of the component
injectStyleObjectn/aAllows user to add or override default inline styles on the root of the component
alignItemsString'center'Accepts start, end, center, stretch, and baseline. Dictates flex behavior.
flexDirectionString'row'Accepts row, row-reverse, column, and column-reverse. Dictates flex behavior.
justifyContentString'center'Accepts start, end, center, space-around and space-between. Dictates flex behavior.
backgroundImageStringn/aOptional image path to background image for the container
lazyLoadWithScrollPositionNumbern/aIf the current window scroll position is passed in, then it enables lazy load on the background image for this container.
lazyLoadOffsetNumber250Determines the scroll offset position for when images get loaded.
isDefaultStylesEnabledBooleantrueEnables or disables the default styling inlined on the component

ContainerBlock

import { ContainerBlock } from 'bf-components'
<ContainerBlock className="custom-class-name" idName="custom-id-name" :injectStyle="customStyleObject" :backgroundImage="image-url.jpg" :lazyLoadWithScrollPosition="currentWindowScrollPosition" lazyLoadOffset="250">
    <div slot="slot-content">
        Whatever you put in here will be centered in a block style container!
    </div>
</ContainerBlock>
PropsTypeDefaultDescription
classNameStringn/aAllows user to add a custom class name to the root of the component
idNameStringn/aAllows user to add a custom id name to the root of the component
injectStyleObjectn/aAllows user to add or override default inline styles on the root of the component
backgroundImageStringn/aOptional image path to background image for the container
isDefaultStylesEnabledBooleantrueEnables or disables the default styling inlined on the component.
lazyLoadWithScrollPositionNumbern/aIf the current window scroll position is passed in, then it enables lazy load on the background image for this container.
lazyLoadOffsetNumber250Determines the scroll offset position for when images get loaded.

Complex Components


ButtonsAppStore

import { ButtonsAppStore } from 'bf-components'
<ButtonsAppStore
    className="custom-class-name"
    idName="custom-id-name"
    injectStyle="customStyleObject"
    assetRoot="path/to/dist/assets/"
    animation="bounce"
    appStoreLink="http://hyperlink-to-app-store.com"
    googleStoreLink="http://hyperlink-to-app-store.com"
    amazonStoreLink="http://hyperlink-to-app-store.com"
    display="inline"
    lazyLoadWithScrollPosition="currentWindowScrollPosition"
    lazyLoadOffset="250"
    :isModalEnabled="true"
>
</ButtonsAppStore>
PropsTypeDefaultDescription
classNameStringn/aAllows user to add a custom class name to the root of the component
idNameStringn/aAllows user to add a custom id name to the root of the component
injectStyleObjectn/aAllows user to add or override default inline styles on the root of the component
assetRootStringn/aPath to the dist assets folder
animationStringn/aAccepts bounce. Determines the css hover animation of the App Store badges.
displayString'inline'Accepts block or inline. Determines how the links are displayed.
isReleasedBooleantrueToggle when game is released. Controls button clickability.
appStoreLinkStringn/aPath to iTunes App Store install link
googleStoreLinkStringn/aPath to Google Play Store install link
amazonStoreLinkStringn/aPath to Amazon Store install link
pcStoreLinkStringn/aPath to PC Store Link.
gameRoomLinkStringn/aPath to Gameroom Link.
isDefaultStylesEnabledBooleantrueEnables or disables the default styling inlined on the component.
lazyLoadWithScrollPositionNumbern/aIf the current window scroll position is passed in, then it enables lazy load on all the button images.
lazyLoadOffsetNumber250Determines the scroll offset position for when images get loaded.
isModalEnabledBooleanfalseControls whether a modal will display when the PC download is clicked with a modal of install information.

IconsSocial

import { IconsSocial } from 'bf-components'
<IconsSocial
    className="custom-class-name"
    idName="custom-id-name"
    injectStyle="customStyleObject"
    assetRoot="path/to/dist/assets/"
    iconSize="xsmall"
    animation="bounce"
    facebookLink="http://facebook.com"
    instagramLink="http://instagram.com"
    linkedinLink="http://linkedin.com"
    pinterestLink="http://pinterest.com"
    twitterLink="http://twitter.com"
    youtubeLink="http://youtube.com"
    lazyLoadWithScrollPosition="currentWindowScrollPosition"
    lazyLoadOffset="250"
></IconsSocial>
PropsTypeDefaultDescription
classNameStringn/aAllows user to add a custom class name to the root of the component
idNameStringn/aAllows user to add a custom id name to the root of the component
injectStyleObjectn/aAllows user to add or override default inline styles on the root of the component
assetRootStringn/aPath to the dist assets folder
iconSizeString'xsmall'Accepts small, medium, large, or xlarge. Determines icon size.
animationStringn/aAccepts bounce. Determines the css hover animation of the icons.
facebookLinkStringn/aPath to Facebook page
instagramLinkStringn/aPath to Instagram page
linkedinLinkStringn/aPath to Linkedin page
pinterestLinkStringn/aPath to Pinterest page
twitterLinkStringn/aPath to Twitter page
youtubeLinkStringn/aPath to Youtube page
lazyLoadWithScrollPositionNumbern/aIf the current window scroll position is passed in, then it enables lazy load on all the icon images.
lazyLoadOffsetNumber250Determines the scroll offset position for when images get loaded.
isDefaultStylesEnabledBooleantrueEnables or disables the default styling inlined on the component.

ModalTtd

import { ModalTtd } from 'bf-components'
    <ModalTtd
        className="custom-class-name"
        idName="custom-id-name"
        assetRoot="path/to/dist/assets/"
        :storedTracking="this.$store.tracking"
        gameTitle="App Name"
        gameId="app-name"
        subPublisher="my-sub-pub"
        subPlacement="hero"
        appStoreLink="http://www.link-to-app-store.com"
        googleStoreLink="http://www.link-to-app-store.com"
        amazonStoreLink="http://www.link-to-app-store.com"
        imageLink="image-url.png"
        lazyLoadWithScrollPosition="currentWindowScrollPosition"
        lazyLoadOffset="250"
        :isModalEnabled="true"
    >
    </ModalTtd>
PropsTypeDefaultDescription
classNameStringn/aAllows user to add a custom class name to the root of the component
idNameStringn/aAllows user to add a custom id name to the root of the component
assetRootStringn/aPath to the dist assets folder
injectStyleObjectn/aAllows user to add or override default inline styles on the root of the component.
appStoreLinkStringn/aLink to the iOS store
googleStoreLinkStringn/aLink to the Google Play Store
amazonStoreLinkStringn/aLink to the Amazon Store
storedTrackingObjectn/aIf the tracking object is passed in, then this is used to create a smartlink for the text-to-download functionality.
subPublisherStringn/aThe sub-publisher for the tracking link
subPlacementStringn/aThe sub-placement for the tracking link
gameTitleString"this game"Replaces 'this game' with the name of the App
gameIdStringn/aRequired ttd id for the app. Usually game title with dashes. ex: cooking-craze
imageLinkString'assets/sms-badge.svg'Link to the button image that toggles the modal
lazyLoadWithScrollPositionNumbern/aIf the current window scroll position is passed in, then it enables lazy load on all the icon images.
lazyLoadOffsetNumber250Determines the scroll offset position for when images get loaded.
isModalEnabledBooleanfalseControls whether a modal will display when the TTD button is clicked.

FooterDefault

import { FooterDefault } from 'bf-components'
<FooterDefault
    assetRoot="path/to/dist/assets/"
    activeItem="genres"
    facebookLink="http://facebook.com"
    instagramLink="http://instagram.com"
    linkedinLink="http://linkedin.com"
    twitterLink="http://twitter.com"
    youtubeLink="http://youtube.com"
    lazyLoadWithScrollPosition="currentWindowScrollPosition"
    lazyLoadOffset="250"
>
</FooterDefault>
PropsTypeDefaultDescription
activeItemString'games'Accepts games, genres, waystoplay, about, and blog. Determines which header is active.
assetRootStringn/aPath to the dist assets folder
FacebookLinkStringn/aPath to Facebook page
instagramLinkStringn/aPath to Instagram page
linkedinLinkStringn/aPath to Linkedin page
twitterLinkStringn/aPath to Twitter page
youtubeLinkStringn/aPath to Youtube page
lazyLoadWithScrollPositionNumbern/aIf the current window scroll position is passed in, then it enables lazy load on all the icon images.
lazyLoadOffsetNumber250Determines the scroll offset position for when images get loaded.

Bf Vue Mixins

Helpful mixins for building your own custom components

Lazy Loading


lazyContentMixin

Add the mixin to your component by doing the following:

import { lazyContentMixin } from 'bf-components'

export default { name: 'MyComponent' mixins: lazyContentMixin }

**This adds the following functionality to your component:**
*You do not need to put this code anywhere its for reference only*
```javascript
const getScrollPosition = require('../utils/get-scroll-position.js')
const handleError = require('../utils/error-handling.js')

module.exports = {
  props: {
    lazyLoadWithScrollPosition: Number,
    lazyLoadOffset: {
      type: Number,
      default: 250
    }
  },
  data: function () {
    return {
      // If lazyLoadWithScrollPosition is defined then contents should be invisible on load
      contentsVisible: typeof this.lazyLoadWithScrollPosition === 'undefined'
    }
  },
  watch: {
    lazyLoadWithScrollPosition: function () {
      // if scroll position is passed down and the images aren't visible yet.
      if (typeof this.lazyLoadWithScrollPosition !== 'undefined' && !this.contentsVisible) {
        const scrollPos = getScrollPosition(this.$el)
        const winHeight = window.innerHeight

        const lazyLoadPosition = scrollPos - winHeight
        if (lazyLoadPosition < this.lazyLoadOffset) {
          this.contentsVisible = true
        }
      }
    }
  },
  mounted: function () {
    if (this.lazyLoadOffset !== 250) {
      handleError(this.lazyLoadWithScrollPosition, 'lazyLoadOffset requires lazyLoadWithScrollPosition to be defined. Element: ' + this.$el)
    }
  }
}

This mixin adds the following props to your component |Props|Type|Default|Description| |--------|:---|:------|:----------| |lazyLoadWithScrollPosition|Number|n/a|If the current window scroll position is passed in, then it enables lazy load on all the icon images. |lazyLoadOffset|Number|250|Determines the scroll offset position for when images get loaded. This mixin adds the following data to your component |Data|Type|Default|Description| |--------|:---|:------|:----------| |contentsVisible|Boolean|n/a|This boolean returns true when the screen position is within the offset range of this component

lazyBackgroundMixin

Add the mixin to your component by doing the following:

import { lazyBackgroundMixin } from 'bf-components'

export default {
    name: 'MyComponent'
    mixins: [lazyBackgroundMixin]
}

This adds the following functionality to your component: You do not need to put this code anywhere its for reference only

const getScrollPosition = require('../utils/get-scroll-position.js')
const handleError = require('../utils/error-handling.js')

module.exports = {
  props: {
    backgroundImage: String,
    lazyLoadWithScrollPosition: Number,
    lazyLoadOffset: {
      type: Number,
      default: 250
    }
  },
  data: function () {
    return {
      // If lazyLoadWithScrollPosition is defined then contents should be invisible on load
      contentsVisible: typeof this.lazyLoadWithScrollPosition === 'undefined'
    }
  },
  watch: {
    lazyLoadWithScrollPosition: function () {
      // if scroll position is passed down and backgroundImage is defined and the images aren't visible yet.
      if (typeof this.backgroundImage !== 'undefined' && typeof this.lazyLoadWithScrollPosition !== 'undefined' && !this.contentsVisible) {
        const scrollPos = getScrollPosition(this.$el)
        const winHeight = window.innerHeight

        const lazyLoadPosition = scrollPos - winHeight
        if (lazyLoadPosition < this.lazyLoadOffset) {
          this.contentsVisible = true
        }
      }
    }
  },
  computed: {
    lazyBackground: function () {
      if (typeof this.lazyLoadWithScrollPosition !== 'undefined') {
        return {
          backgroundImage: this.contentsVisible && this.backgroundImage ? 'url(' + this.backgroundImage + ')' : 'none',
          opacity: this.contentsVisible ? 1 : 0,
          transition: 'all 1s ease-in'
        }
      } else if (this.backgroundImage) {
        return {
          backgroundImage: 'url(' + this.backgroundImage + ')'
        }
      } else {
        return
      }
    }
  },
  mounted: function () {
    if (this.lazyLoadOffset !== 250) {
      handleError(this.lazyLoadWithScrollPosition, 'lazyLoadOffset requires lazyLoadWithScrollPosition to be defined. Element: ' + this.$el.className)
    }
  }
}

This mixin adds the following props to your component |Props|Type|Default|Description| |--------|:---|:------|:----------| |lazyLoadWithScrollPosition|Number|n/a|If the current window scroll position is passed in, then it enables lazy load on all the icon images. |lazyLoadOffset|Number|250|Determines the scroll offset position for when images get loaded. This mixin adds the following computed to your component |Data|Type|Default|Description| |--------|:---|:------|:----------| |lazyBackground|String|'none'|Triggers the background image when the screen position is within the offset range of this component

Component Functionality Mixins


modalMixin

Add the mixin to your component by doing the following:

import { modalMixin } from 'bf-components'

export default {
    name: 'MyComponent'
    mixins: [mdoalMixin]
}

This adds the following functionality to your component: You do not need to put this code anywhere its for reference only

module.exports = {
  props: {
    isModalEnabled: {
      type: Boolean,
      default: false
    }
  },
  data: function () {
    return {
      isModalActive: false,
      isModalTriggerHover: false,
      modalClassName: ''
    }
  },
  methods: {
    toggleModalActiveFn: function () {
      if (this.isModalEnabled) {
        var modalStatus = !this.isModalActive
        this.modalClassName = (modalStatus) ? 'modal-trigger-active' : ''
        this.isModalActive = modalStatus
      }
    },
    toggleModalHoverFn: function () {
      if (this.isModalEnabled && !this.isModalActive) {
        this.isModalTriggerHover = !this.isModalTriggerHover
        this.modalClassName = (this.isModalTriggerHover) ? 'modal-trigger-hover' : ''
      }
    }
  }
}

Utility Mixins


contentTypeMixin

Determines the content type of of a link

Add the mixin to your component by doing the following:

import { contentTypeMixin } from 'bf-components'

export default {
    name: 'MyComponent'
    mixins: [contentTypeMixin]
}

This adds the following functionality to your component: You do not need to put this code anywhere its for reference only

module.exports = {
  props: {
    contentLink: String
  },
  methods: {
    isImage: function (url) {
      return (url.match(/\.(jpeg|jpg|gif|png)$/) != null)
    }
  },
  computed: {
    contentType: function () {
      if (typeof this.contentLink !== 'undefined') {
        if (this.isImage(this.contentLink)) {
          return 'image'
        } else return 'video'
      }
    }
  }
}

This mixin adds the following props to your component |Props|Type|Default|Description| |--------|:---|:------|:----------| |contentLink|String|n/a|The link to the content you need type determined on

This mixin adds the following computed to your component |Data|Type|Default|Description| |--------|:---|:------|:----------| |contentType|String|n/a|Returns the content type of the contentLink

1.3.658

6 years ago

1.3.657

6 years ago

1.3.656

6 years ago

1.3.655

6 years ago

1.3.654

6 years ago

1.3.653

6 years ago

1.3.652

6 years ago

1.3.651

6 years ago

1.3.650

6 years ago

1.3.649

6 years ago

1.3.648

6 years ago