Code Monkey home page Code Monkey logo

silverstripe-elemental-stylings's Introduction

SilverStripe Elemental Stylings

Latest Stable Version Total Downloads Latest Unstable Version License

Introduction

This module extends a SilverStripe Elemental Blocks to enhance its functionalities with predefined sets of Classes of Styling elements.

Predefined Styling classes:

  • StylingHeight - changes a height of a Block
  • StylingHorizontalAlign - changes a horizontal alignment of a Block
  • StylingLimit - changes a limit of a Block
  • StylingSize - changes a size of a Block
  • StylingStyle (extended from Core module) - special enhancements for a class extended from Core module
  • StylingTextAlign - changes a text alignment inside of a Block
  • StylingVerticalAlign - changes a vertical alignment of a Block
  • StylingWidth - changes a width of a Block (example uses Bootstrap Grid syntax)

The module provides basic markup for each of the stylings but you have an option to edit and/or replace those predefined styles.

Requirements

  • SilverStripe CMS ^4.0
  • SilverStripe Elemental Blocks ^4

Installation

  • Install a module via Composer
composer require fractas/elemental-stylings
  • Follow an instructions for installation of Elemental Blocks module
  • Apply a desired Styling Class extension on Block class (ie. ElementContent that ships with Core module) mysite/_config/elements.yml
  DNADesign\Elemental\Models\ElementContent:
    extensions:
      - Fractas\ElementalStylings\StylingHeight
      - Fractas\ElementalStylings\StylingHorizontalAlign
      - Fractas\ElementalStylings\StylingStyle
      - Fractas\ElementalStylings\StylingTextAlign
      - Fractas\ElementalStylings\StylingVerticalAlign
      - Fractas\ElementalStylings\StylingWidth
  • Add an desired styles based on your preferences, see Configuration example
  • Optionaly, you can require basic CSS stylings provided with this module to your controller class like: mysite/code/PageController.php
        Requirements::css('fractas/elemental-stylings:client/dist/css/stylings.css');
  • Build and flush your project vendor/bin/sake dev/build flush=1

Full configuration example

This is a sample configuration for use of Stylings classes in YML configuration.

mysite/_config/elements.yml

DNADesign\Elemental\Models\ElementContent:
  extensions:
    - Fractas\ElementalStylings\StylingHeight
    - Fractas\ElementalStylings\StylingHorizontalAlign
    - Fractas\ElementalStylings\StylingStyle
    - Fractas\ElementalStylings\StylingTextAlign
    - Fractas\ElementalStylings\StylingVerticalAlign
    - Fractas\ElementalStylings\StylingWidth
  styles:
    light: 'Light background color with Dark text'
    dark: 'Dark background color with White text'
  textalign:
    left: 'Left'
    right: 'Right'
    center: 'Center'
  horalign:
    left: 'Left'
    right: 'Right'
    center: 'Center'
  veralign:
    top: 'Top'
    middle: 'Middle'
    bottom: 'Bottom'
  height:
    small: 'Small'
    medium: 'Medium'
    large: 'Large'
  width:
    col-sm-6: '50%'
    col-sm-4: '33.33%'
    col-sm-12: '100%'

Implementation example: 'Text with Image' Element

Screenshots

Updated GridField with preview of applied stylings: GridFieldStylings

Styling tab of a Block with icons for specific styles: BlockStylings

Reporting Issues

Please create an issue for any bugs you've found, or features you're missing.

License

See License

Credits

Styling icons from IcoMoon - Free by IcoMoon

silverstripe-elemental-stylings's People

Contributors

hdpero avatar jelicanin avatar korthjp17 avatar muskie9 avatar sunnysideup avatar wernerkrauss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

silverstripe-elemental-stylings's Issues

Elemental requirements

I was trying to add this today, but it's set for Elemental ^2.0. Can this be updated with ^2.0 or ^3.0?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.