Skip to content

Commit

Permalink
style: remove prettier formatting for grid, shorter display
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlj95 committed Nov 21, 2024
1 parent 9c0a6dd commit 45f7d01
Showing 1 changed file with 40 additions and 6 deletions.
46 changes: 40 additions & 6 deletions projects/ngx-meta/docs/content/migrations/01-meta-element-apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ No automatic migration via schematics are available for this change. Manual migr

Here you have some examples of how the same thing can be achieved using old and new APIs:

<!-- prettier-ignore-start -->

#### Set a single `<meta>` element

Let's set a `<meta name="description">` element:
Expand All @@ -91,12 +93,18 @@ Let's set a `<meta name="description">` element:

```typescript title="Before"
const metaService = inject(NgxMetaMetaService)
metaService.set(makeKeyValMetaDefinition('description'), 'foo')
metaService.set(
makeKeyValMetaDefinition('description'),
'foo'
)
```

```typescript title="After"
const metaService = inject(NgxMetaElementsService)
metaService.set(withNameAttribute('description'), withContentAttribute('foo'))
metaService.set(
withNameAttribute('description'),
withContentAttribute('foo')
)
```

</div>
Expand All @@ -122,7 +130,10 @@ metaService.set(
undefined, // or null or empty array
)
// or also just
metaService.set(withNameAttribute('description'), withContentAttribute(undefined))
metaService.set(
withNameAttribute('description'),
withContentAttribute(undefined)
)
```

</div>
Expand All @@ -135,12 +146,24 @@ Like a `<meta name="theme-color">` with a `media` attribute:

```typescript title="Before"
const metaService = inject(NgxMetaMetaService)
metaService.set(makeKeyValMetaDefinition('theme-color', { extras: { media: '(prefers-color-scheme: dark)' } }), 'darkblue')
metaService.set(
makeKeyValMetaDefinition(
'theme-color',
{ extras: { media: '(prefers-color-scheme: dark)' } }
),
'darkblue'
)
```

```typescript title="After"
const metaService = inject(NgxMetaElementsService)
metaService.set(withNameAttribute('theme-color'), withContentAttribute('darkblue', { media: '(prefers-color-scheme: dark)' }))
metaService.set(
withNameAttribute('theme-color'),
withContentAttribute(
'darkblue',
{ media: '(prefers-color-scheme: dark)' }
)
)
```

</div>
Expand All @@ -157,9 +180,20 @@ Like multiple `<meta name="theme-color">`:

```typescript title="After"
const metaService = inject(NgxMetaElementsService)
metaService.set(withNameAttribute('theme-color'), [withContentAttribute('darkblue', { media: '(prefers-color-scheme: dark)' }), withContentAttribute('lightblue')])
metaService.set(
withNameAttribute('theme-color'),
[
withContentAttribute(
'darkblue',
{ media: '(prefers-color-scheme: dark)' }
),
withContentAttribute('lightblue')
]
)
```

</div>

<!-- prettier-ignore-end -->

[^1]: For more details, check out the [deprecation PR](https://github.com/davidlj95/ngx/pull/955)

0 comments on commit 45f7d01

Please sign in to comment.