Skip to content

Commit cef240f

Browse files
jonasjabarigitbook-bot
authored andcommitted
GitBook: [main] one page modified
1 parent fd60923 commit cef240f

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

docs/README.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,42 @@ Read about `matestack-ui-core` here: [https://docs.matestack.io/matestack-ui-cor
1414

1515
How much do you enjoy copy&pasting complex DOM structures and giant chains of CSS classes across your APP in order to create a decent looking UI?
1616

17-
With `matestack-ui-core` you're luckily able to build complex DOM structures ONCE in pure Ruby in a Matestack component and reuse it across your app without copy&pasting. So this component may look like this:
17+
With `matestack-ui-core` you're luckily able to build complex DOM structures ONCE in pure Ruby in a Matestack component and reuse it across your app without copy&pasting. So this component may look like this \(without using `matestack-ui-bootstrap`!\):
1818

1919
{% code title="app/matestack/components/card\_component.rb" %}
2020
```ruby
2121
class Components::CardComponent < Matestack::Ui::Component
22-
22+
23+
required :title
24+
optional :image_path, :content
25+
2326
def response
2427
div class: "card shadow-sm border-0 bg-light" do
25-
img path: "...", class: "w-100"
26-
body_partial # calling the below defined instance method
28+
img path: context.image_path, class: "w-100" if context.image_path
29+
body_partial
2730
end
2831
end
29-
32+
3033
private
31-
34+
3235
def body_partial
3336
div class: "card-body" do
34-
h5 "foo", class: "card-title"
35-
paragraph "bar", class: "card-text"
37+
h5 context.title, class: "card-title"
38+
paragraph context.content, class: "card-text" if context.content
3639
end
3740
end
38-
41+
3942
end
4043
```
4144
{% endcode %}
4245

43-
`matestack-ui-core` has no opinion about styling. That's why you need to build a Bootstrap card component \(or whatever CSS approach you prefer\) yourself. In case you're into Bootstrap: Wouldn’t it be cool to have all Bootstrap components available like that in pure Ruby?
46+
**`matestack-ui-core` has no opinion about styling. That's why you need to build a Bootstrap card component \(or whatever CSS approach you prefer\) yourself.**
47+
48+
In case you're into Bootstrap: Wouldn’t it be cool to have all Bootstrap components available like that in pure Ruby?
4449

4550
That's at least what we thought and why we've created `matestack-ui-bootstrap`shipping all you need to build beautiful, reactive UIs in pure Ruby and smart CRUD components based on Bootstrap v5.
4651

47-
So a card is already implemented and would be used like that:
52+
So **the card component is already implemented** and would simply ****be used like that without any need of implementing the component yourself:
4853

4954
```ruby
5055
bs_card title: "foo", body: "bar"

0 commit comments

Comments
 (0)