Skip to content

ISSUE #123 adds aside component to main components #223

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

Merged
merged 4 commits into from
Oct 9, 2019
Merged
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
3 changes: 3 additions & 0 deletions app/concepts/matestack/ui/core/aside/aside.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
%aside{@tag_attributes}
- if block_given?
= yield
5 changes: 5 additions & 0 deletions app/concepts/matestack/ui/core/aside/aside.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Matestack::Ui::Core::Aside
class Aside < Matestack::Ui::Core::Component::Static

end
end
31 changes: 31 additions & 0 deletions docs/components/aside.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# matestack core component: Aside

Show [specs](/spec/usage/components/aside_spec.rb)

The HTML `<aside>` tag implemented in ruby.

## Parameters

This component can take 2 optional configuration params and optional content.

#### # id (optional)
Expects a string with all ids the aside tag should have.

#### # class (optional)
Expects a string with all classes the aside tag should have.

## Example 1

```ruby
aside id: "foo", class: "bar" do
paragraph text: "This is some text"
end
```

returns

```html
<aside id="foo" class="bar">
<p>This is some text</p>
</aside>
```
44 changes: 44 additions & 0 deletions spec/usage/components/aside_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
require_relative "../../support/utils"
include Utils

describe "Aside Component", type: :feature, js: true do
it "Example 1" do
class ExamplePage < Matestack::Ui::Page

def response
components {
#simple aside
aside

#simple aside with attributes
aside id: "my-id", class: "my-class"

#nested aside
aside do
paragraph text: "This is some text"
end
}
end

end

visit "/example"

static_output = page.html

expected_static_output = <<~HTML
<aside></aside>

<aside id="my-id" class="my-class"></aside>

<aside>
<p>This is some text</p>
</aside>
HTML

expect(stripped(static_output)).to include(stripped(expected_static_output))
end

end