-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove aspect ratio from
YouTubeBlock
(#2235)
Due to the media block standardization and following from this the video block revisions we decided to remove the aspect ratio from the YouTubeBlock. --------- Co-authored-by: Johannes Obermair <[email protected]>
- Loading branch information
1 parent
3ea123f
commit a589188
Showing
11 changed files
with
90 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
"@comet/blocks-admin": major | ||
"@comet/cms-site": major | ||
"@comet/cms-api": major | ||
--- | ||
|
||
Remove `aspectRatio` from `YouTubeBlock` | ||
|
||
The block's aspect ratio options (4x3, 16x9) proved too inflexible to be of actual use in an application. Therefore, the aspect ratio field was removed. It should be defined in the application instead. | ||
|
||
**Migrate** | ||
|
||
The block requires an aspect ratio in the site. It should be set using the `aspectRatio` prop (default: `16x9`): | ||
|
||
```diff | ||
<YouTubeVideoBlock | ||
data={video} | ||
+ aspectRatio="9x16" | ||
/> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...api/blocks-api/src/blocks/YouTubeVideoBlock/migrations/1-remove-aspect-ratio.migration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { BlockMigration } from "../../../migrations/BlockMigration"; | ||
import { BlockMigrationInterface } from "../../../migrations/types"; | ||
|
||
interface From { | ||
youtubeIdentifier?: string; | ||
aspectRatio: unknown; | ||
autoplay?: boolean; | ||
showControls?: boolean; | ||
loop?: boolean; | ||
} | ||
|
||
interface To { | ||
youtubeIdentifier?: string; | ||
autoplay?: boolean; | ||
showControls?: boolean; | ||
loop?: boolean; | ||
} | ||
|
||
export class RemoveAspectRatioMigration extends BlockMigration<(from: From) => To> implements BlockMigrationInterface { | ||
public readonly toVersion = 1; | ||
|
||
protected migrate({ aspectRatio, ...other }: From): To { | ||
return { ...other }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.