0.2.22 • Published 1 month ago

optimizepress-ui v0.2.22

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month ago

OptimizePress UI

This package contains all the global styles and scripts used throughout OptimizePress plugins.

It contains Bootstrap 4 and FontAwesome 4, but all the class names are prefixed with 'opui-', so to use bootstrap you need to prefix it in you HTML:

<a href="#" class="opui-btn opui-btn-primary>Button example</a>

Or to use FontAwesome:

<i class="opui-fa opui-anchor"></i>

Installation

To install the package you need to run the following command:

npm install optimizepress-ui

WordPress

To use the package inside an OptimizePress plugin, the best way is to use Laravel Mix and the sass-loader. So your webpack.mix.js should contain this:

let mix = require('laravel-mix');
mix.sass('resources/scss/app.scss', 'public/assets/css')
mix.js(['resources/js/app.js'], 'public/assets/js')

Inside your app.scss you simply need to include the UI like this:

$opui-wrapper: '#wpbody';
@import '~optimizepress-ui/src/scss/ui';

The $opui-wrapper is required because WordPress loads some style of its own, and to keep everything consistent we need to wrap all the classes.

Build

Building is required only if you want to contribute to the package. Otherwise, just use the package as described in the WordPress section.

To build all you required assets inside the package you need to run:

npm run dev

Or:

npm run watch

Keep in mind that upon running the command the first time, you will most likely get an error message regarding the sass loader. This is due to the fact that Laravel Mix requires different versions of the loader depending on your node.js version, so the correct version will be installed when running the command for the first time.

After that you simply need to run the command one more time, and it should all be good.

Scripts

The only script included for now is toggling the fullscreen mode in WordPress plugins. This is achieved by toggling a body class. An example on how to use the script can be found in the tests directory:

import {toggleFullscreen} from "../js/fullscreen";

document.addEventListener("DOMContentLoaded", function() {
    document.querySelector('.opui-fullscreen-btn').addEventListener('click', function (event) {
        event.preventDefault();
        toggleFullscreen('https://jsonplaceholder.typicode.com/posts/1');
    }, false);
});

The function accepts an attribute for an API endpoint URL. This endpoint should be used to store the current fullscreen state.

Preview

You can preview all components here: Preview UI Components

Contributing

To contribute to the package, simply clone the repository, make you changes, build the assets, and make a pull request.

Ideally you need to visit the test screens and watch if something is broken before sending the PR.

0.2.22

1 month ago

0.2.21

4 months ago

0.2.20

7 months ago

0.2.19

2 years ago

0.2.18

2 years ago

0.2.17

2 years ago

0.2.16

2 years ago

0.2.14

2 years ago

0.2.13

2 years ago

0.2.11

2 years ago

0.2.10

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.5

2 years ago

0.1.27

2 years ago

0.1.28

2 years ago

0.1.29

2 years ago

0.1.23

2 years ago

0.1.24

2 years ago

0.1.25

2 years ago

0.1.26

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.2

2 years ago

0.2.4

2 years ago

0.1.20

2 years ago

0.1.21

2 years ago

0.1.22

2 years ago

0.1.17

2 years ago

0.1.18

2 years ago

0.1.19

2 years ago

0.1.12

2 years ago

0.1.13

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.1.16

2 years ago

0.1.10

2 years ago

0.1.11

2 years ago

0.1.9

2 years ago

0.1.1

3 years ago