-
-
Notifications
You must be signed in to change notification settings - Fork 542
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
60 additions
and
41 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,40 @@ | ||
--- | ||
"@lekoarts/gatsby-theme-minimal-blog": minor | ||
--- | ||
|
||
This theme uses [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer) for its code blocks. The version was updated from `1.3.5` to `2.0.6` and it contains some breaking changes in regards to the API surface. | ||
|
||
If you modified the theme in any way (e.g. by shadowing or adding additional Prism languages) you need to apply those changes, too. | ||
|
||
## Change of module imports | ||
|
||
```diff | ||
- import Highlight, { defaultProps } from "prism-react-renderer"; | ||
+ import { Highlight } from "prism-react-renderer" | ||
|
||
const Content = ( | ||
- <Highlight {...defaultProps} code={exampleCode} language="jsx"> | ||
+ <Highlight code={exampleCode} language="jsx"> | ||
``` | ||
|
||
## Custom languages | ||
|
||
```js | ||
import { Highlight, Prism } from "prism-react-renderer"; | ||
|
||
(typeof global !== "undefined" ? global : window).Prism = Prism | ||
await import("prismjs/components/prism-applescript") | ||
/** or **/ | ||
require("prismjs/components/prism-applescript") | ||
``` | ||
|
||
## Theme imports | ||
|
||
```diff | ||
- import vsDark from "prism-react-renderer/themes/vsDark" | ||
+ import { themes } from "prism-react-renderer" | ||
+ const { vsDark } = themes | ||
|
||
- const theme = require('prism-react-renderer/themes/vsDark') | ||
+ const theme = require('prism-react-renderer').themes.vsDark | ||
``` |
32 changes: 13 additions & 19 deletions
32
examples/minimal-blog/content/posts/code-block-examples/SpotifyPlayer.js
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 |
---|---|---|
@@ -1,37 +1,31 @@ | ||
/* eslint react/no-unknown-property: 0 */ | ||
/* eslint react/prefer-stateless-function: 0 */ | ||
|
||
/** | ||
* Spotify player iframe widget | ||
* | ||
* @author Alexander Wallin <[email protected]> | ||
* @see https://developer.spotify.com/technologies/widgets/spotify-play-button/ | ||
*/ | ||
|
||
import * as React from "react" | ||
|
||
// Size presets, defined by Spotify | ||
const sizePresets = { | ||
large: { | ||
width: 300, | ||
height: 380, | ||
normal: { | ||
width: `100%`, | ||
height: `352px`, | ||
}, | ||
compact: { | ||
width: 300, | ||
height: 80, | ||
width: `100%`, | ||
height: `152px`, | ||
}, | ||
} | ||
|
||
function SpotifyPlayer({ uri, view, theme, size }) { | ||
function SpotifyPlayer({ albumUri = `6Ar5HxNWXtvraqs7FI7bYq`, size = `normal` }) { | ||
return ( | ||
<iframe | ||
title="Spotify" | ||
className="SpotifyPlayer" | ||
src={`https://embed.spotify.com/?uri=${uri}&view=${view}&theme=${theme}`} | ||
style={{ | ||
borderRadius: `12px`, | ||
}} | ||
src={`https://open.spotify.com/embed/album/${albumUri}?theme=0`} | ||
width={sizePresets[size].width} | ||
height={sizePresets[size].height} | ||
frameBorder="0" | ||
allowtransparency="true" | ||
allowfullscreen="" | ||
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" | ||
loading="lazy" | ||
/> | ||
) | ||
} | ||
|
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