generated from nimblehq/git-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from nimblehq/chore/task-3-configure-view_comp…
…onent-and-view_component_storybook [Task-3][Chore] Configure view_component and view_component_storybook
- Loading branch information
Showing
44 changed files
with
4,336 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
stories: ["../test/components/**/*.stories.json"], | ||
addons: ["@storybook/addon-controls"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const parameters = { | ||
server: { | ||
url: `${location.protocol}${location.hostname}${ | ||
location.port !== "" ? ":3000" : "" | ||
}/rails/view_components`, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<a href="<%= link %>" class="<%= classes %>"> | ||
<%= content %> | ||
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# frozen_string_literal: true | ||
|
||
class ButtonComponent < ViewComponent::Base | ||
attr_accessor :type, :link | ||
|
||
PRIMARY_CLASSES = %w[ | ||
btn-primary | ||
].freeze | ||
SECONDARY_CLASSES = %w[ | ||
btn-secondary | ||
].freeze | ||
SUCCESS_CLASSES = %w[ | ||
btn-success | ||
].freeze | ||
DANGER_CLASSES = %w[ | ||
btn-danger | ||
].freeze | ||
LINK_CLASSES = %w[ | ||
btn-link | ||
].freeze | ||
|
||
BASE_CLASSES = %w[ | ||
btn | ||
].freeze | ||
|
||
BUTTON_TYPE_MAPPING = { | ||
primary: PRIMARY_CLASSES, | ||
secondary: SECONDARY_CLASSES, | ||
success: SUCCESS_CLASSES, | ||
danger: DANGER_CLASSES, | ||
link: LINK_CLASSES | ||
}.freeze | ||
|
||
def initialize(type: :primary, link: '#') | ||
@type = type | ||
@link = link | ||
super | ||
end | ||
|
||
def classes | ||
(BUTTON_TYPE_MAPPING[@type] + BASE_CLASSES).join(' ') | ||
end | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
class PostsController < ApplicationController | ||
def index; end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<article class="m-4"> | ||
<h1 class="mb-4">ViewComponents blog post</h1> | ||
<h2 id="firstPost">#1 Button Primary</h2> | ||
<%= render(ButtonComponent.new(type: :primary, link: '#firstPost')) do %> | ||
Primary | ||
<% end %> | ||
<h2 id="secondPost">#2 Button Secondary</h2> | ||
<%= render(ButtonComponent.new(type: :secondary, link: '#secondPost')) do %> | ||
Secondary | ||
<% end %> | ||
<h2 id="secondPost">#2 Button Danger</h2> | ||
<%= render(ButtonComponent.new(type: :danger, link: '#thirdPost')) do %> | ||
Primary | ||
<% end %> | ||
<h2 id="fourthPost">#4 Button Link</h2> | ||
<%= render(ButtonComponent.new(type: :link, link: '#fourthPost')) do %> | ||
Link | ||
<% end %> | ||
</article> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
public/_storybook/4.75d5a1b06644935772d5.manager.bundle.js.LICENSE.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* Prism: Lightweight, robust, elegant syntax highlighting | ||
* | ||
* @license MIT <https://opensource.org/licenses/MIT> | ||
* @author Lea Verou <https://lea.verou.me> | ||
* @namespace | ||
* @public | ||
*/ |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
public/_storybook/6.fd11e4fc27dcf8d83371.manager.bundle.js.LICENSE.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/*! | ||
* OverlayScrollbars | ||
* https://github.com/KingSora/OverlayScrollbars | ||
* | ||
* Version: 1.13.0 | ||
* | ||
* Copyright KingSora | Rene Haas. | ||
* https://github.com/KingSora | ||
* | ||
* Released under the MIT license. | ||
* Date: 02.08.2020 | ||
*/ |
Oops, something went wrong.