Skip to content

Commit 527af1f

Browse files
committed
[ADD] awsome_owl: task 3 (card)
1 parent 61dd212 commit 527af1f

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { useState, Component } from "@odoo/owl";
2+
3+
export class Card extends Component {
4+
static template = "awesome_owl.Card";
5+
6+
static props = {
7+
title : {type: String},
8+
content : {type: String}
9+
}
10+
11+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<templates xml:space="preserve">
3+
4+
<t t-name="awesome_owl.Card">
5+
<div class="card d-inline-block m-2" style="width: 18rem;">
6+
<div class="card-body">
7+
<h5 class="card-title">
8+
<t t-out="props.title"/>
9+
</h5>
10+
<p class="card-text">
11+
<t t-out="props.content"/>
12+
</p>
13+
</div>
14+
</div>
15+
</t>
16+
17+
</templates>

awesome_owl/static/src/playground.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { Component, useState } from "@odoo/owl";
22
import { Counter } from "./counter/counter"
3+
import { Card } from "./card/card";
34

45
export class Playground extends Component {
56
static template = "awesome_owl.Playground";
6-
static components = {Counter};
7+
static components = { Counter, Card };
78

89
setup() {
910
}

awesome_owl/static/src/playground.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
<Counter/>
1010
<Counter/>
1111
</div>
12+
<div>
13+
<Card title="'card 1'" content="'content of card 1'"/>
14+
<Card title="'card 2'" content="'content of card 2'"/>
15+
</div>
1216
</t>
1317

1418
</templates>

0 commit comments

Comments
 (0)