Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symfony 3 compatibility #1527

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 13 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// const Fiber = require('fibers');
const sass = require('dart-sass');
const sass = require('sass');

module.exports = function(grunt) {

Expand Down Expand Up @@ -240,6 +240,18 @@ module.exports = function(grunt) {
],
dest: 'dist/'
}]
},
symfony: {
files: [{
expand: true,
cwd: '',
src: [
'fonts/**/*',
'images/**/*',
'stylesheets/**/*'
],
dest: 'Resources/public/'
}]
}
},

Expand Down
14 changes: 8 additions & 6 deletions app/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
use Jadu\Pulsar\Twig\Extension\UrlParamsExtension;
use Jadu\Pulsar\Twig\Extension\TabsExtension;

$loader = new Twig_Loader_Filesystem($templateDir);
$loader = new \Twig\Loader\FilesystemLoader($templateDir);
$loader->addPath($templateDir, 'pulsar');

$twig = new Twig_Environment($loader,
$twig = new \Twig\Environment($loader,
array(
'debug' => true,
'strict_variables' => true
Expand All @@ -34,14 +34,16 @@
$twig->addExtension(new RelativeTimeExtension());
$twig->addExtension(new UrlParamsExtension($_GET));
$twig->addExtension(new TabsExtension());
$twig->addExtension(new Twig_Extension_Debug());
$twig->addExtension(new \Twig\Extension\DebugExtension());

if (strstr($_SERVER['PATH_INFO'], '.html.twig')) {
$template = $twig->loadTemplate($_SERVER['PATH_INFO']);
$template = $twig->load($_SERVER['PATH_INFO']);
} else {
$template = $twig->loadTemplate($_SERVER['PATH_INFO'] . '/index.html.twig');
$template = $twig->load($_SERVER['PATH_INFO'] . '/index.html.twig');
}

// define('theme', 'projector');
// Show deprecations
// $deprecations = new \Twig\Util\DeprecationCollector($twig);
// print_r($deprecations->collectDir($templateDir));

print $template->render(array());
2 changes: 1 addition & 1 deletion app/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$loader = new Twig_Loader_Filesystem($templateDir);
$loader->addPath($baseDir . 'views', 'pulsar');

$twig = new Twig_Environment($loader,
$twig = new \Twig\Environment($loader,
array(
'debug' => true,
'strict_variables' => true
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
},
"require": {
"twig/twig": "^2.0"
"twig/twig": "^3.0"
},
"require-dev": {
"symfony/yaml": "*"
Expand Down
108 changes: 108 additions & 0 deletions docs/docs/components/accordion.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
id: accordion
title: Accordion
sidebar_label: Accordion
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Show and hide sections of content.

<div className="d-example">
<div id="accordionGroup" className="accordion">
<div className="accordion__panel">
<button type="button" aria-expanded="true" className="accordion__trigger" aria-controls="sect1" id="accordion1id" title="expand"></button>
<h2 className="accordion__title" id="accordion1title">Section One</h2>
<div id="sect1" role="region" aria-labelledby="accordion1title" className="accordion__content">
Content One
</div>
</div>
<div className="accordion__panel">
<button type="button" className="accordion__trigger" aria-controls="sect2" id="accordion2id"></button>
<h2 className="accordion__title" id="accordion2title">Section Two</h2>
<div id="sect2" role="region" aria-labelledby="accordion2title" className="accordion__content">
Content Two
</div>
</div>
<div className="accordion__panel">
<button type="button" className="accordion__trigger" aria-controls="sect3" id="accordion3id"></button>
<h2 className="accordion__title" id="accordion3title">Section Three</h2>
<div id="sect3" role="region" aria-labelledby="accordion3title" className="accordion__content">
Content Three
</div>
</div>
</div>
</div>

## Basic usage

<Tabs
groupID="example"
defaultValue="html"
values={[
{ label: 'HTML', value: 'html', },
]
}>
<TabItem value="html">

```html
<div id="accordionGroup" className="accordion">
<div className="accordion__panel">
<button type="button" aria-expanded="true" className="accordion__trigger" aria-controls="sect1" id="accordion1id" title="expand"></button>
<h2 className="accordion__title" id="accordion1title">Section One</h2>
<div id="sect1" role="region" aria-labelledby="accordion1title" className="accordion__content">
Content One
</div>
</div>
<div className="accordion__panel">
<button type="button" className="accordion__trigger" aria-controls="sect2" id="accordion2id"></button>
<h2 className="accordion__title" id="accordion2title">Section Two</h2>
<div id="sect2" role="region" aria-labelledby="accordion2title" className="accordion__content">
Content Two
</div>
</div>
<div className="accordion__panel">
<button type="button" className="accordion__trigger" aria-controls="sect3" id="accordion3id"></button>
<h2 className="accordion__title" id="accordion3title">Section Three</h2>
<div id="sect3" role="region" aria-labelledby="accordion3title" className="accordion__content">
Content Three
</div>
</div>
</div>
```

</TabItem>
</Tabs>

## Style variations

### Bordered

`.accordion--bordered`

<div className="d-example">
<div id="accordionGroup" className="accordion accordion--bordered">
<div className="accordion__panel">
<button type="button" aria-expanded="true" className="accordion__trigger" aria-controls="sect4" id="accordion4id" title="expand"></button>
<h2 className="accordion__title" id="accordion1title">Section One</h2>
<div id="sect4" role="region" aria-labelledby="accordion4title" className="accordion__content">
<p>Content One</p>
</div>
</div>
<div className="accordion__panel">
<button type="button" className="accordion__trigger" aria-controls="sect5" id="accordion5id"></button>
<h2 className="accordion__title" id="accordion5title">Section Two</h2>
<div id="sect5" role="region" aria-labelledby="accordion5title" className="accordion__content">
<p>Content Two</p>
</div>
</div>
<div className="accordion__panel">
<button type="button" className="accordion__trigger" aria-controls="sect6" id="accordion6id"></button>
<h2 className="accordion__title" id="accordion6title">Section Three</h2>
<div id="sect6" role="region" aria-labelledby="accordion6title" className="accordion__content">
<p>Content Three</p>
</div>
</div>
</div>
</div>
58 changes: 58 additions & 0 deletions docs/src/css/custom-dark.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/* stylelint-disable docusaurus/copyright-header */
/**
* Any CSS included here will be global. The classic template
* bundles Infima by default. Infima is a CSS framework designed to
* work well for content-centric websites.
*/

$theme: 'dark' !default;

.d-example,
.d-example-inline,
.d-guidelines {
@import '../../../stylesheets/mixin.media-queries';
@import '../../../stylesheets/mixin.mixins-to-organise';

// Functions
@import '../../../stylesheets/function.math';
@import '../../../stylesheets/function.color-luminance';
@import '../../../stylesheets/function.pick-best-color';
@import '../../../stylesheets/function.color';

// Config
@import '../../../stylesheets/config.variables';
@import '../../../stylesheets/config.branding';

// Functions
@import '../../../stylesheets/function.math';
@import '../../../stylesheets/function.color-luminance';
@import '../../../stylesheets/function.pick-best-color';
@import '../../../stylesheets/function.color';

// Base colour palette
@import '../../../stylesheets/palette.base';
@import '../../../stylesheets/palette.dark';
@import '../../../stylesheets/palette.maps';
@import '../../../stylesheets/config.theme';

.bg--dark {
background-color: color(background);

code {
background-color: color(background, light);
border-color: rgba(255, 255, 255, .2);
color: color(text);
}
}

.swatch {
@each $name, $palette in $colors {
@each $variant, $value in $palette {
&--#{'' + $name}-#{$variant} .swatch__chip--dark {
background-color: color($name, $variant);
color: pick_best_color(color($name, $variant), (#fff, #000));
}
}
}
}
}
18 changes: 18 additions & 0 deletions docs/src/js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// /**
// * Pulsar
// *
// * Core UI components that should always be present.
// *
// * Jadu Ltd.
// */

// // Fixes issue with dependencies that expect both $ and jQuery to be set
// window.jQuery = window.$ = require('jquery');

// // Global UI components
// var $ = require('jquery'),
// AccordionComponent = require('..//AccordionComponent');

// module.exports = {
// AccordionComponent
// };
20 changes: 20 additions & 0 deletions docs/src/js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(function ($) {

// Protect IE8 from any erroneous console.log uses which would break everything
if (!window.console) {
console = { log: function() {} }
}

var $html = $('html'),
lt10 = $html.hasClass('lt-ie10');

$html.removeClass('no-js');

pulsar.accordion = new pulsar.AccordionComponent($html);

$(function () {
console.log(pulsar);
pulsar.accordion.init();
});

}(jQuery));
2 changes: 1 addition & 1 deletion js/TimePickerComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ class TimePickerComponent {
}
}

module.exports = TimePickerComponent;
export default TimePickerComponent;
Loading