forked from cardstack/boxel
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpet-person.gts
54 lines (51 loc) · 1.31 KB
/
pet-person.gts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import {
contains,
linksTo,
linksToMany,
field,
Component,
CardDef,
} from 'https://cardstack.com/base/card-api';
import StringCard from 'https://cardstack.com/base/string';
import { Pet } from './pet';
import { Person } from './person';
import { GridContainer } from '@cardstack/boxel-ui/components';
export class PetPerson extends CardDef {
static displayName = 'Pet Person';
@field firstName = contains(StringCard);
@field pets = linksToMany(Pet);
@field friend = linksTo(Person);
@field title = contains(StringCard, {
computeVia: function (this: PetPerson) {
return `${this.firstName} Pet Person`;
},
});
static embedded = class Embedded extends Component<typeof this> {
<template>
<GridContainer>
<h3><@fields.firstName /></h3>
Pets:
<@fields.pets />
Friend:
<@fields.friend />
</GridContainer>
</template>
};
static isolated = class Isolated extends Component<typeof this> {
<template>
<GridContainer class='container'>
<h2><@fields.title /></h2>
<h2><@fields.firstName /></h2>
Pets:
<@fields.pets />
Friend:
<@fields.friend />
</GridContainer>
<style>
.container {
padding: var(--boxel-sp-xl);
}
</style>
</template>
};
}