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

Initialize Storybook #1152

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
heading: 'Welcome to your new Project UI Library with Storybook!'
text: '<p>Check out the example component:</p>'
bullets:
0: '<strong>example.stories.js:</strong> initializes and configures your component.'
1: '<strong>example.html.twig:</strong> the template for rendering your component.'
2: '<strong>example.data.yml:</strong> defines the default data used in rendering the component.'
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{#
/**
* Example
*
* Available variables:
* - heading: String value.
* - text: String value.
* - bullets: Array of string values.
**/
#}

{{ attach_library('project/example') }}

<h2 class="example-heading">{{ heading }}</h2>

{{ text }}

{% if bullets | length %}
<ul>
{% for bullet in bullets %}
<li>{{ bullet }}</li>
{% endfor %}
</ul>
{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Example from "./example.html.twig";
import data from './example.data.yml';
import "./src/example.style.scss";
import "./src/example.behavior.js";

export default {
title: "Project/Example",
args: { ...data },
component: Example,
};

export const Default = {};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("Don't worry, I'm just an example");
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
h2.example-heading {
color: blue;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name: Test
4 changes: 4 additions & 0 deletions web/themes/custom/votegov/components/project/test/test.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.mytest {
color: blue;
font-weight: bold;
}
1 change: 1 addition & 0 deletions web/themes/custom/votegov/components/project/test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert('SCD');
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<span class="mytest">{{ text }}</span>
20 changes: 19 additions & 1 deletion web/themes/custom/votegov/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion web/themes/custom/votegov/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"description": "",
"main": "gulpfile.js",
"scripts": {
"copy": "npm run copy:templates",
"copy:templates": "cp -rfp node_modules/votestorybook/components/project components",
"copy:css": "cp -rfp node_modules/votestorybook/components/dist/css dist/js",
"copy:js": "cp -rfp node_modules/votestorybook/components/dist/js dist/css",
"copy:assets": "cp -rfp node_modules/votestorybook/components/dist/assets dist/assets",
"gulp": "gulp watch",
"dev": "gulp",
"build": "gulp build"
Expand All @@ -15,7 +20,8 @@
"@uswds/uswds": "^3.9.0",
"gulp": "^5.0.0",
"gulp-uglify": "^3.0.2",
"uglify-es": "^3.3.9"
"uglify-es": "^3.3.9",
"votestorybook": "github:rayestrada/votestorybook#main"
},
"overrides": {
"glob-parent": "6.0.2",
Expand Down