storybook_engine 1.0.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 259c82e1e29f570fc6332c61dcc59500ca1d120c30bef04f82559cd7b658e28c
4
- data.tar.gz: f42c8bbf6a9a2c0d9d40746fd5cee69e5873ddd7540d2aa5a1063d2c49d38d3f
3
+ metadata.gz: e7aa3da5c44192a6dc68131d8ded024feb262bd57aa0d26438721367ed1304ca
4
+ data.tar.gz: 0d045606313ee5676e43b037aa3f37ce9f12f30cab5fc21e40fa75f655d6e5e8
5
5
  SHA512:
6
- metadata.gz: 6b873c27638be9137ebcce48a19238a4fabc518c2afa03ee90059c78608ee58d7f1a6d27f2afb87b0c6fde83e1e6e606ce4f1042e1076dbf3d4f904dd50fd655
7
- data.tar.gz: ee452c15d91348445e79abbe86b0f59712e019af10a03718f8a1a8d7085c7767d30b984b382e977f9218214351d7f182a8f909049a6668e9d85a076ffbef6e57
6
+ metadata.gz: 54fed5ba1bb52f919c7d19a5d57331fedeced8fdcf6a0ee288a1507ff630a82e7cb7417ed09c360b1aeb69f01c20fecbabf6edb3b77e8fce5cae6bf782d021c1
7
+ data.tar.gz: 162ea2792b093d87e31b8f819d4da26641e00860fea44c95df8f1acfcdec0a759e8307c74e67e0f1819ccfe8b3d9129ab6246eaf868ce4f9860c68e633466a64
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # StorybookEngine
2
- Short description and motivation.
2
+ Storybook with view components rails engine
3
3
 
4
4
  ## Usage
5
- How to use my plugin.
6
-
5
+ ##### Button
6
+ ```ruby
7
+ = render(ButtonComponent.new(options: {type: "submit"},classes: "w-100")) { "Save" }
8
+ ```
7
9
  ## Installation
8
10
  Add this line to your application's Gemfile:
9
11
 
@@ -21,8 +23,10 @@ Or install it yourself as:
21
23
  $ gem install storybook_engine
22
24
  ```
23
25
 
24
- ## Contributing
25
- Contribution directions go here.
26
+ After add gem please add this line into your applications.scss:
27
+ ```bash
28
+ @import "storybook_engine/application";
29
+ ```
26
30
 
27
31
  ## License
28
32
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -13,3 +13,9 @@
13
13
  *= require_tree .
14
14
  *= require_self
15
15
  */
16
+
17
+ @import "helpers/mixins";
18
+ @import "helpers/colors";
19
+ @import "helpers/common-used";
20
+
21
+ @import "components/buttons";
@@ -0,0 +1,59 @@
1
+ @import "../helpers/colors";
2
+
3
+ .zenhr-button {
4
+ padding: 0.9rem;
5
+ height: 3.5rem;
6
+ min-width: 9rem;
7
+
8
+ &:disabled {
9
+ cursor: not-allowed;
10
+ pointer-events: none;
11
+ }
12
+ }
13
+
14
+ .zenhr-primary-button {
15
+ color: $white;
16
+ --bg-opacity: 1;
17
+ background-color: $primary-blue;
18
+ border-color: $primary-blue;
19
+
20
+ &:hover, :focus {
21
+ color: $primary-blue;
22
+ background-color: $white;
23
+ border-color: $primary-blue;
24
+ box-shadow: 0 0 0.25rem 0 $primary-blue;
25
+ }
26
+
27
+ &:disabled {
28
+ opacity: 0.65;
29
+ }
30
+ }
31
+
32
+ .zenhr-danger-button {
33
+ color: $white;
34
+ --bg-opacity: 1;
35
+ background-color: #f56565;
36
+
37
+ &:hover, :focus {
38
+ background-color: #e53e3e;
39
+ }
40
+
41
+ &:disabled {
42
+ background-color: #feb2b2;
43
+ }
44
+ }
45
+
46
+ .zenhr-outline-button {
47
+ color: #805ad5;
48
+ border-color: #805ad5;
49
+ --bg-opacity: 1;
50
+ background-color: $white;
51
+
52
+ &:hover, :focus {
53
+ background-color: #edf2f7;
54
+ }
55
+
56
+ &:disabled {
57
+ background-color: #f7fafc;
58
+ }
59
+ }
@@ -0,0 +1,5 @@
1
+ $charcoal: #484848;
2
+ $red: #e30b1c;
3
+ $black: #000;
4
+ $white: #fff;
5
+ $primary-blue: #007bff;
@@ -0,0 +1,31 @@
1
+ @import "colors";
2
+ @import "mixins";
3
+
4
+ .delete-action {
5
+ cursor: pointer;
6
+
7
+ &:hover {
8
+ color: $red;
9
+ }
10
+ }
11
+
12
+ .table {
13
+ @include desktop {
14
+ display: table;
15
+ }
16
+ }
17
+
18
+ .error-message {
19
+ color: $red;
20
+ font-size: 0.75rem;
21
+ }
22
+
23
+ .cursor-pointer {
24
+ cursor: pointer;
25
+ }
26
+
27
+ .zenhr-link {
28
+ &:hover {
29
+ text-decoration: none;
30
+ }
31
+ }
@@ -0,0 +1,13 @@
1
+ // Custom small screen
2
+ @mixin mobile {
3
+ @media (max-width: 768px) {
4
+ @content;
5
+ }
6
+ }
7
+
8
+ // Custom large screen
9
+ @mixin desktop {
10
+ @media (min-width: 769px) {
11
+ @content;
12
+ }
13
+ }
@@ -1,2 +1,2 @@
1
1
  %button{{class: classes}.merge(@options)}
2
- = content
2
+ = content
@@ -0,0 +1,5 @@
1
+ .form-group
2
+ - if !@options[:label].nil?
3
+ %label{class: @options[:label_classes]}
4
+ = @options[:label]
5
+ %input{class: classes,"name" => @options[:field_name],"value"=> @options[:default_value],"placeholder"=>@options[:placeholder]}
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ class InputComponent < ViewComponent::Base
4
+ BASE_CLASSES = "form-control"
5
+
6
+ def initialize(options:,classes: '')
7
+ @options = options
8
+ @classes = classes
9
+ end
10
+
11
+ def classes
12
+ "#{@classes} #{BASE_CLASSES}"
13
+ end
14
+
15
+ end
@@ -0,0 +1,2 @@
1
+ %label{{class: @classes }.merge(@options)}
2
+ = content
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class LabelComponent < ViewComponent::Base
4
+ def initialize(options:, classes: '')
5
+ @options = options
6
+ @classes = classes
7
+ end
8
+
9
+ end
@@ -0,0 +1,2 @@
1
+ %a{{class: classes}.merge(@options)}
2
+ = content
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ class LinkComponent < ViewComponent::Base
4
+ BASE_CLASSES = "zenhr-link"
5
+
6
+ def initialize(options:, classes: '')
7
+ @options = options
8
+ @classes = classes
9
+ end
10
+
11
+ def classes
12
+ "#{BASE_CLASSES} #{@classes}"
13
+ end
14
+
15
+ end
@@ -5,7 +5,7 @@
5
5
  <%= csrf_meta_tags %>
6
6
  <%= csp_meta_tag %>
7
7
 
8
- <%= stylesheet_link_tag "storybook_engine/application", media: "all" %>
8
+ <%= stylesheet_link_tag "storybook_engine/_storybook_engine", media: "all" %>
9
9
  </head>
10
10
  <body>
11
11
 
@@ -1,3 +1,3 @@
1
1
  module StorybookEngine
2
- VERSION = '1.0.0'
2
+ VERSION = '1.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: storybook_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amr Abu Aza
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-25 00:00:00.000000000 Z
11
+ date: 2021-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -41,9 +41,19 @@ files:
41
41
  - README.md
42
42
  - Rakefile
43
43
  - app/assets/config/storybook_engine_manifest.js
44
- - app/assets/stylesheets/storybook_engine/application.scss
45
- - app/components/storybook_engine/button_component.html.haml
46
- - app/components/storybook_engine/button_component.rb
44
+ - app/assets/stylesheets/storybook_engine/_storybook_engine.scss
45
+ - app/assets/stylesheets/storybook_engine/components/_buttons.scss
46
+ - app/assets/stylesheets/storybook_engine/helpers/_colors.scss
47
+ - app/assets/stylesheets/storybook_engine/helpers/_common-used.scss
48
+ - app/assets/stylesheets/storybook_engine/helpers/_mixins.scss
49
+ - app/components/ButtonComponent/button_component.html.haml
50
+ - app/components/ButtonComponent/button_component.rb
51
+ - app/components/InputComponent/input_component.html.haml
52
+ - app/components/InputComponent/input_component.rb
53
+ - app/components/LabelComponent/label_component.html.haml
54
+ - app/components/LabelComponent/label_component.rb
55
+ - app/components/LinkComponent/link_component.html.haml
56
+ - app/components/LinkComponent/link_component.rb
47
57
  - app/controllers/storybook_engine/application_controller.rb
48
58
  - app/helpers/storybook_engine/application_helper.rb
49
59
  - app/jobs/storybook_engine/application_job.rb