Home
Wiki
Home
Wiki
  1. Components
  • Back to home
  • 1. Themes
  • Vs Code
    • Getting Started
  • Kitchenware
    • Layout
      • New Layout
      • Legacy Layout
    • Components
      • Announcement
      • Banner Carousel
      • Banner With Products Carousel
      • Blog Category List
      • Blog List
      • Brand List
      • Brands Carousel
      • Breadcrumb
      • Call To Action
      • Cart
      • Categories List
      • Change Password
      • Checkout
      • Cookie Manager
      • Filter list
      • Footer
      • Forgot Password
      • Form
      • Hero Carousel
      • Icon Block
      • Invitation
      • Last Visited Products
      • Layout
      • Login
      • Map
      • Nav Bar
      • Offer
      • Product Attachments
      • Product Attributes
      • Product Documentation
      • Product Expected
      • Product Modal
      • Products Block
      • Products Carousel
      • Product Single
      • Profile
      • Quote
      • Register
      • Related Products
      • Search
      • Stores
      • Subscribe Newsletter
      • Text with Image
      • Top Bar
      • Video
    • Reusables
      • Getting Started
    • Assets
      • Getting Started
    • SDK
      • Products
        • _findProductsByCategory
        • _findProductsByIds
        • _findProductsByTitle
        • _findProductsByFilter
        • _findProductsByCriteria
        • _findProductsAndCalculate
        • _findProductsThenCalculate
        • _getProductAttributeSet
        • _setLastVisited
      • Categories
        • _findCategoryTreeById
        • _findCategoriesByIds
        • _findCategoryByAlias
        • _findCategoryTreeByAlias
        • _getCategoryContent
      • Collections
        • _getCollectionContent
        • _findCollectionsByIds
        • _findCollectionsByIdsThenCalculate
      • Brands
        • _getBrandContent
        • _findBrandsByIds
      • Cart
        • _addToCartMulti
        • _addToCart
        • _setCart
        • _clearCart
        • _setCartListener
        • _removeFromCart
        • _calculateCart
      • Checkout
        • _startCheckout
        • _updateCheckout
        • _completeCheckout
      • Shopping Lists
        • _getShoppingLists
        • _updateShoppingList
        • _createShoppingList
        • _deleteShoppingList
        • _getShoppingListByAlias
      • Navigation
        • _getFooterMenu
        • _getHeaderMenu
      • Users
        • _getUserById
      • Utils
        • _calculateCurrency
        • _getCurrencySymbol
        • _getCulture
        • _subscribeToNewsletter
        • _findUnitsByIds
  • Noir
  1. Components

Video

Video Block Component Documentation#

Overview#

The Video Block component is a component designed to display videos from popular platforms like YouTube and Vimeo. It allows for embedding videos within a webpage, with optional header and text content. The component is customizable, supporting alignment and CSS class modifications.

Model Documentation#

Model Structure#

The Video Block component relies on the following model structure:
id: A unique identifier for the video block section.
cssClass: Additional CSS classes for styling the video block.
header: (Optional) A header text to be displayed above the video.
text: (Optional) Text content to be displayed under the header and above the video.
link: The URL of the video to be embedded.
alignment: Alignment of the header and text content, with values ranging from 1 (left), 2 (center), to 3 (right).

Example Model#

Here’s an example of how the model might be structured:

Component Structure#

The Video Block component consists of the following sections:
1.
HTML Template: Defines the structure of the video block, including the video, header, and text content.
2.
JavaScript: Handles the component's logic, including parsing video URLs and setting up embedded video links.
3.
Data: Contains the model data and properties like videoUrl and embeddedUrl.
4.
Methods: Includes helper methods for parsing YouTube and Vimeo URLs and aligning content.

HTML Template#

The HTML template defines the structure of the Video Block component.

Explanation of HTML Elements:#

section: The main container for the video block, with dynamic id and cssClass attributes.
header: Displays the header text, if provided, and aligns it based on the alignment value.
text: Displays optional text content below the header.
iframe: Embeds the video using the parsed embeddedUrl, ensuring the video occupies the full available width and height.

JavaScript#

The JavaScript section handles the core logic of the Video Block component, including parsing video URLs and setting up the embedded video link.

Component Definition#

Explanation of JavaScript Code:#

Props: The model object contains the content and settings for the video block.
Data:
data: Holds the model data for easy access.
videoUrl: Stores the raw video URL provided in the model.
embeddedUrl: Stores the formatted video URL suitable for embedding.
Mounted: On component mount, the videoUrl is parsed and formatted into an embeddable link based on whether it's a YouTube or Vimeo link.
Methods:
youtube_parser(): Extracts the video ID from a YouTube URL and returns it for embedding.
vimeo_parser(): Extracts the video ID from a Vimeo URL and returns it for embedding.
getAlignmentClass(): Returns the appropriate alignment class based on the alignment value in the model.
Modified at 2024-08-27 12:17:56
Previous
Top Bar
Next
Getting Started
Built with