1.0.6 • Published 6 years ago

iviparagraphs v1.0.6

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

ivislider

"IviParagraphs" is a service for easy creation of Drupal paragraphs

Description

  • IviParagraphs is a responsive and lightweight collection of customizable Drupal paragraphs.
  • No jQuery is required.
  • Accepts info in json format.
  • You can change css settings very quickly

Package Managers

NPM
npm install iviparagraphs

#####Usage

Just import Class (for example in the js code that you bundle later with webpack):

import IviParagraphs from './iviparagraphs/IviParagraphs';

Add scss to webpack:

 'iviparagraphs': [
            'PATH/iviparagraphs/style.scss'
        ],

Import Drupal paragraphs with appropriate fields

Let`s start!

import IviParagraphs from './iviparagraphs/IviParagraphs';
let paragraphs = new IviParagraphs();
paragraphs.init();

Customize the panel if you want to:

import IviParagraphs from './iviparagraphs/IviParagraphs';
let paragraphs = new IviParagraphs(
    {
        horImage: {
            height: 0.4,
            marginBottom: 5,
            marginTop: 5
        },
        text: {
            span: true,
            spanstyle1: 'blueline',
            spanstyle2: '',
            spanstyle3: 'doubleline',
            marginTop: 5,
            marginBottom: 5,
            style1: {
                main: {
                    backgroundColor: '#70847b',
                    color: '#132836',
                    padding: {
                        responsive: {
                            0: '40px 0',
                            1023: '60px 0',
                            1200: '120px 0'
                        }
                    }
                },
                words: {
                    padding: '0 10px',
                    width: '100%',
                    maxWidth: '800px',
                    display: 'inline-block',
                    marginBottom: '40px',
                    marginTop: {
                        responsive: {
                            0: '20px',
                            1200: '40px'
                        }
                    }
                },
                title: {
                    marginBottom: '20px',
                },
                subtitle: {
                    padding: '0 20px',
                    marginBottom: {
                        responsive: {
                            0: '20px',
                            1200: '40px'
                        }
                    }
                },
                subtitleClass: 'h4',
                titleClass: 'h3',
                textClass: 'high-text',
                linkClass: 'about__btn'
            },
            style2: {

            }

        },
        fsImage: {
            style: {
                title: {
                    color: '#fff',
                }
            }

        }
    }
);
paragraphs.init();

JSON

By address 'rest/api/par/horimg/%' should be accessible JSON: (where % is fid of image)

$file = file_load($fid);
        $uri = $file->uri;

        $img = [];
        $img[] = file_create_url($uri);

        drupal_json_output(array_values($img));

Site Header

If you want to count header height the header must have ID = "header"

Settings

Horizontal image (paragraphs.horImage)

OptionTypeDefaultDescription
marginTopinteger20Defines margin-top
marginBottominteger20Defines margin-top
heightinteger0.4Part of screen that should be the height of slider with a deduction of header Height (for example: use 1 if you want to have fullscreen slide)

Text (paragraphs.text)

(accepts 3 styles, one of them - with img bg)

OptionTypeDefaultDescription
spanbooleanfalsedefine if you want to add a span. If there will be min title and text it will before text. Else it will be after title
spanstyle1string''Span class for the first style
spanstyle2string''Span class for the second style
spanstyle3string''Span class for the third style
defaultStylebooleanfalsedefine if you want to use default style. Setting true blocks other customization
imageWrapperDefaultbooleanfalsedefine if you want to use default style (half-transparent bg) for text elements in style with image
style1, style2, style3object-Objects that contain styles for all elements
main, words, title, subtitle, linkobject-Objects in style that contain styles for all particular elements (may be responsive)
subtitleClass, titleClass, textClass, linkClassstring-may be in every style. Add classes to elements
marginTopinteger20Defines margin-top
marginBottominteger20Defines margin-top

Full-size image (paragraphs.fsimage)

OptionTypeDefaultDescription
marginTopinteger20Defines margin-top
marginBottominteger20Defines margin-top
spanbooleanfalsedefine if you want to add a span. If there will be min title and text it will before text. Else it will be after title
spanClassstring''Span class
arrowClassstring'iviparagraphs__fsimage-elementarrow-default'Down-arrow class
bottomOffsetinteger0Defines what offset should be from bottom
imageLayerbooleanfalsedefine if you want to have a transparent black overlay between image and title
defaultTitlebooleanfalsedefine if you want to use default class for title (if is set "true" it will not allow to use titleClass option)
titleClassstring'h2'Title class
styleobject{}Object that contain styles for elements

Video (paragraphs.videoPar)

OptionTypeDefaultDescription
marginTopinteger20Defines margin-top
marginBottominteger20Defines margin-top

Gallery (paragraphs.gallery)

OptionTypeDefaultDescription
marginTopinteger20Defines margin-top
marginBottominteger20Defines margin-top
style1, style2, style3object-Objects that contain info for definite style
firstDefaultArrowsbooleantruedefine if you want to use default arrows style for buttons in the first Gallery
firstMousedragbooleantruedefine if you want the gallery to move with mouse drag
firstTouchdragbooleantruedefine if you want the gallery to move with touch drag
firstButtonsToMovebooleantruedefine if you want to control the gallery with buttons wth arrows
firstControlKeysbooleantruedefine if you want to control the gallery wth arrows keys
Gallery first style (paragraphs.gallery.style1)
OptionTypeDefaultDescription
horizontalPaddinginteger5padding left and right for each image
heightobjectheight: {responsive: {0: 250, 767: 300,1023: 450,1200: 550}},Height of the gallery for each screen
cloneBackgroundstring'#fff'The background of your gallery (or page). It should be defined in order to make the clone of gallery not transparent by moving
placeholderBackgroundstring'#faf2eb'Defines the background of the placeholder (when the gallery is being loaded)
arrowsPositionstring'right'define where you want to put the control arrows. May be left, right, justify, centre, bottom
placeholderSrcstring'/sites/all/themes/tgtheme/misc/dist/images/iviparagraphs/placeholder.png'The src of the placeholder (when the gallery is being loaded)

Text and Image (paragraphs.textAndImage)

(accepts 4 styles, one of them - with img bg)

OptionTypeDefaultDescription
spanbooleanfalsedefine if you want to add a span. If there will be min title and text it will before text. Else it will be after title
spanstyle1string''Span class for the first style
spanstyle2string''Span class for the second style
spanstyle3string''Span class for the third style
spanstyle4string''Span class for the fourth style
defaultStylebooleanfalsedefine if you want to use default style. Setting true blocks other customization
imageWrapperDefaultbooleanfalsedefine if you want to use default style (half-transparent bg) for text elements in style with image
defaultImgWidthobjectdefaultImgWidth: {responsive: {0: 100,767: 50}},Width of the images for each screen
marginTopinteger20Defines margin-top
marginBottominteger20Defines margin-top
style1, style2, style3, style4object-Objects that contain styles for all elements
main, text, title, subtitle, link, ImgWidth, TextWidthobject-Objects in style that contain styles for all particular elements (may be responsive)
subtitleClass, titleClass, textClass, linkClassstring-may be in every style. Add classes to elements

Two texts (paragraphs.twotexts)

(accepts 4 styles, one of them - with img bg)

OptionTypeDefaultDescription
spanbooleanfalsedefine if you want to add a span. If there will be min title and text it will before text. Else it will be after title
spanstyle1string''Span class for the first style
spanstyle2string''Span class for the second style
spanstyle3string''Span class for the third style
spanstyle4string''Span class for the fourth style
defaultStylebooleanfalsedefine if you want to use default style. Setting true blocks other customization
imageWrapperDefaultbooleanfalsedefine if you want to use default style (half-transparent bg) for text elements in style with image
narrowWidthobjectnarrowWidth: {responsive: {0: '100%',767: '50%',}},Width of the narrow part for each screen
wideWidthobjectwideWidth: {responsive: {0: '100%',767: '50%'},Width of the wide part for each screen
marginTopinteger20Defines margin-top
marginBottominteger20Defines margin-top
zeroElementsPaddinginteger20Defines vertical padding of elements for smaller screens
largeElementsPaddinginteger40Defines vertical padding of elements for larger screens
style1, style2, style3, style4object-Objects that contain styles for all elements
main, text, title, subtitle, link, textwrapper, widetextwrapperobject-Objects in style that contain styles for all particular elements (may be responsive)
subtitleClass, titleClass, textClass, linkClassstring-may be in every style. Add classes to elements

Three parts (paragraphs.threeparts)

(accepts 4 styles, one of them - with img bg. The width of parts is 33.333%)

OptionTypeDefaultDescription
marginTopinteger20Defines margin-top
marginBottominteger20Defines margin-top
style1, style2, style3, style4object-Objects that contain styles for all elements
main, text, title, textwrapperobject-Objects in style that contain styles for all particular elements (may be responsive)
titleClass, textClassstring-may be in every style. Add classes to elements

Vertical image (paragraphs.vertimg)

(1 style)

OptionTypeDefaultDescription
marginTopinteger20Defines margin-top
marginBottominteger20Defines margin-top
img, titleobject-Objects that contain styles for all particular elements (may be responsive)
titleClass-Adds classes to elements

Horizontal single image (paragraphs.horsingleimg)

(1 style)

OptionTypeDefaultDescription
marginTopinteger20Defines margin-top
marginBottominteger20Defines margin-top
img, titleobject-Objects that contain styles for all particular elements (may be responsive)
titleClass-Adds classes to elements

Browser support

IviParagraphs works on IE8+ in addition to other modern browsers such as Chrome, Firefox, and Safari.

License

Copyright (c) 2018 tstudio

Licensed under the MIT license.

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago