Skip to content

Commit d1a7601

Browse files
betocantu93jenweber
authored andcommitted
Refactor MU and fix typos (ember-learn#602)
1 parent cbf1b61 commit d1a7601

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

guides/release/components/defining-a-component.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ installing component-test
5858

5959
This generates a JavaScript file:
6060

61-
```javascript {data-file=src/ui/components/blog-post/component.js}
61+
```javascript {data-filename=app/components/blog-post.js}
6262
import Component from '@glimmer/component';
6363

6464
export default class BlogPost extends Component {}
6565
```
6666

6767
And a template file:
6868

69-
```handlebars {data-filename=src/ui/components/blog-post/template.hbs}
69+
```handlebars {data-filename=app/templates/components/blog-post.hbs}
7070
{{yield}}
7171
```
7272

@@ -77,10 +77,10 @@ will be covered later on in the guides.
7777

7878
Templates in components use the Handlebars templating language, as discussed in
7979
the [Templating](../../templating) section. A component's template is the layout
80-
that is used when rendering the component. If we update the `HelloButton`'s
80+
that is used when rendering the component. If we update the `BlogPost`'s
8181
template to be:
8282

83-
```handlebars {data-filename=src/ui/components/hello-post/template.hbs}
83+
```handlebars {data-filename=app/templates/components/blog-post.hbs}
8484
<h1>Fun Facts About Tomster</h1>
8585
<section>
8686
1. He's a hamster!
@@ -90,7 +90,7 @@ template to be:
9090

9191
And then use the component like so:
9292

93-
```handlebars {data-filename=src/ui/routes/application/route.hbs}
93+
```handlebars {data-filename=app/templates/application.hbs}
9494
<BlogPost/>
9595
```
9696

@@ -107,7 +107,7 @@ This template doesn't have anything dynamic in it yet, so the output is exactly
107107
the same as the template. We can add dynamic values directly by using double
108108
curly syntax:
109109

110-
```handlebars {data-filename=src/ui/components/blog-post/template.hbs}
110+
```handlebars {data-filename=app/templates/components/blog-post.hbs}
111111
<h1>{{@title}}</h1>
112112
<section class="{{this.sectionClass}}">
113113
{{@content}}
@@ -141,7 +141,7 @@ important to note that arguments and properties can be used interchangeably, so
141141
we could for instance have used an argument for the `sectionClass`, and a
142142
class property for title or post content:
143143

144-
```handlebars {data-filename=src/ui/components/blog-post/template.hbs}
144+
```handlebars {data-filename=app/templates/components/blog-post.hbs}
145145
<h1>{{this.title}}</h1>
146146
<section class="{{@sectionClass}}">
147147
{{this.content}}
@@ -158,7 +158,7 @@ to the component where it is used.
158158
You can also use template helpers, modifiers, and other components within your
159159
component template:
160160

161-
```handlebars {data-filename=src/ui/components/blog-post/template.hbs}
161+
```handlebars {data-filename=app/templates/components/blog-post.hbs}
162162
<h1>{{capitalize @title}}</h1>
163163
164164
<BlogSection>
@@ -184,7 +184,7 @@ helper allows us to specify that users can pass the component a _block_ of
184184
children, and where those children should be placed. If we go back to our
185185
`BlogPost` component, we can add a yield like this:
186186

187-
```handlebars {data-filename=src/ui/components/blog-post/template.hbs}
187+
```handlebars {data-filename=app/templates/components/blog-post.hbs}
188188
<h1>{{@title}}</h1>
189189
<section class="{{this.sectionClass}}">
190190
{{yield}}
@@ -225,7 +225,7 @@ statements in a component block, and these will be inserted in the yield:
225225
A final thing that component templates can have is `...attributes`, which can be
226226
placed on any HTML element or component within the component's template:
227227

228-
```handlebars {data-filename=src/ui/components/blog-post/template.hbs}
228+
```handlebars {data-filename=app/templates/components/blog-post.hbs}
229229
<h1>{{@title}}</h1>
230230
<section ...attributes class="{{this.sectionClass}}">
231231
{{yield}}
@@ -262,11 +262,11 @@ own state, such as components that focus on presentation and formatting of data.
262262
For example, you could make a Template-Only greeting component that receives the
263263
name of a friend and greets them:
264264

265-
```handlebars {data-filename=src/ui/components/greeting/template.hbs}
265+
```handlebars {data-filename=app/templates/components/greeting.hbs}
266266
<p>Hello {{@friend}}</p>
267267
```
268268

269-
```handlebars {data-filename=src/ui/routes/application/template.hbs}
269+
```handlebars {data-filename=app/templates/application.hbs}
270270
<Greeting @friend="Toby"/>
271271
```
272272

@@ -277,7 +277,7 @@ discussed in detail in the [Working With
277277
JavaScript](../../working-with-javascript/native-classes) section of the guides.
278278
You can define a component class like so:
279279

280-
```js {data-file=src/ui/components/blog-post/component.js}
280+
```js {data-filename=app/components/blog-post.js}
281281
import Component from '@glimmer/component';
282282

283283
export default class BlogPost extends Component {}
@@ -294,33 +294,33 @@ You can add methods and fields to the component, and then access them from the
294294
component's template. For instance, we could add the `sectionClass` property
295295
that is referenced in the template for the `BlogPost` component from earlier:
296296

297-
```handlebars {data-filename=src/ui/components/blog-post/template.hbs}
297+
```handlebars {data-filename=app/templates/components/blog-post.hbs}
298298
<h1>{{@title}}</h1>
299299
<section ...attributes class="{{this.sectionClass}}">
300300
{{yield}}
301301
</section>
302302
```
303303

304-
```js {data-file=src/ui/components/blog-post/component.js}
304+
```js {data-filename=app/components/blog-post.js}
305305
import Component from '@glimmer/component';
306306

307307
export default class HelloButton extends Component {
308308
sectionClass = 'blog-post-section';
309309
}
310310
```
311311

312-
You can also use JavaScript accessors (_getters_ and \_setters) to derive values
312+
You can also use JavaScript accessors (_getters_ and _setters_) to derive values
313313
that need to be calculated. For instance, we could provide a default title to
314314
the blog post if one wasn't provided:
315315

316-
```handlebars {data-filename=src/ui/components/blog-post/template.hbs}
316+
```handlebars {data-filename=app/templates/components/blog-post.hbs}
317317
<h1>{{this.title}}</h1>
318318
<section ...attributes class="{{this.sectionClass}}">
319319
{{yield}}
320320
</section>
321321
```
322322

323-
```js {data-file=src/ui/components/blog-post/component.js}
323+
```js {data-filename=app/components/blog-post.js}
324324
import Component from '@glimmer/component';
325325

326326
export default class HelloButton extends Component {
@@ -337,7 +337,7 @@ differently in the class.
337337
Methods can also be defined on the class and called from the template. These are
338338
known as _actions_, and are decorated with the `@action` decorator.
339339

340-
```handlebars {data-filename=src/ui/components/blog-post/template.hbs}
340+
```handlebars {data-filename=app/templates/components/blog-post.hbs}
341341
<h1>{{this.title}}</h1>
342342
<section ...attributes class="{{this.sectionClass}}">
343343
{{yield}}
@@ -348,7 +348,7 @@ known as _actions_, and are decorated with the `@action` decorator.
348348
</section>
349349
```
350350

351-
```js {data-file=src/ui/components/blog-post/component.js}
351+
```js {data-filename=app/components/blog-post.js}
352352
import Component from '@glimmer/component';
353353

354354
export default class HelloButton extends Component {

0 commit comments

Comments
 (0)