Skip to content

Commit f78ed65

Browse files
authored
Merge pull request #11 from mateonunez/blog/consuming-spotify-apis
Blog - Consuming Spotify APIs
2 parents 7d97485 + 81cdc2b commit f78ed65

File tree

12 files changed

+726
-10
lines changed

12 files changed

+726
-10
lines changed

articles/consuming-spotify-apis.mdx

Lines changed: 685 additions & 0 deletions
Large diffs are not rendered by default.

articles/hello-blog.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ title: 'How I made my Blog with Next.js and MDX'
33
date: 2022-04-19T10:54:18.459Z
44
description: 'Hello stranger! In this article I will show you how I made my blog serverless with Next.js and MDX.'
55
tags:
6-
- Next.JS
7-
- MDX
8-
- JavaScript
6+
- next.js
7+
- mdx
8+
- javascript
99
image: '/images/articles/hello-blog/cover.png'
1010
author:
1111
name: Mateo

components/articles/mdx/image/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default function MDXImage({
1212
quality,
1313
priority,
1414
href,
15+
target = '_self',
1516
...rest
1617
}) {
1718
const ImageWrapper = (
@@ -34,7 +35,7 @@ export default function MDXImage({
3435
<div className={s.root}>
3536
{href ? (
3637
<Link href={href} fancy={false} passHref>
37-
<a href={href} alt={alt} aria-label={alt} title={alt}>
38+
<a href={href} alt={alt} aria-label={alt} title={alt} target={target}>
3839
{ImageWrapper}
3940
</a>
4041
</Link>

components/articles/meta/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Link from 'next/link';
44

55
import { dateWithoutYearForHumans } from 'lib/helpers/date';
66
import { Clock, Tag, User } from 'components/icons';
7+
import { kebapCase } from 'lib/helpers/string';
78

89
export default function ArticleMeta({ date, author, readingTime, tags = [] }) {
910
return (
@@ -23,7 +24,7 @@ export default function ArticleMeta({ date, author, readingTime, tags = [] }) {
2324
<div className={s.tagList}>
2425
{tags.map((tag, index) => (
2526
<span className={index !== tags.length - 1 ? 'mr-2' : ''} key={tag}>
26-
<Link href="/blog/tags/[tag]" as={`/blog/tags/${tag}`}>
27+
<Link href={`/blog/tags/${kebapCase(tag)}`} as={`/blog/tags/${kebapCase(tag)}`}>
2728
<a className={s.tag} title={tag}>
2829
#{tag}
2930
</a>

components/spotify/recently-played/recently-played.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export default function RecentlyPlayed({ items }) {
1717
left:
1818
direction === 'left'
1919
? current.scrollLeft - current.clientWidth - config.munber
20-
: current.scrollLeft + current.clientWidth - config.munber,
20+
: direction === 'right'
21+
? current.scrollLeft + current.clientWidth - config.munber
22+
: 0,
2123
behavior: 'smooth'
2224
});
2325
}

lib/helpers/string.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Convert a string into kebap-case
3+
*
4+
* @param {String} str
5+
* @returns {String}
6+
*/
7+
const kebapCase = str =>
8+
str
9+
.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)
10+
.map(x => x.toLowerCase())
11+
.join('-');
12+
13+
/**
14+
* Get thi initials from string
15+
*
16+
* @param {String} str
17+
* @returns {String}
18+
*/
19+
const initials = str =>
20+
str
21+
.match(/(?<=\s|^)\p{L}\p{Mn}*/gu)
22+
?.filter((_, i, array) => i === 0 || i === array.length - 1)
23+
.join('') || '';
24+
25+
export { kebapCase, initials };

pages/_app.jsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import 'styles/global.css';
2+
import 'styles/nprogress.css';
3+
import 'components/articles/mdx/code/dark.css';
4+
5+
import React from 'react';
6+
17
import { GTMProvider } from '@elgorditosalsero/react-gtm-hook';
28
import { Head, MainLayout } from 'components';
3-
import 'components/articles/mdx/code/dark.css';
49
import { UIProvider } from 'components/ui/ui-context';
5-
import React from 'react';
6-
import 'styles/global.css';
7-
import 'styles/nprogress.css';
810

911
export default function App({ Component, pageProps }) {
1012
// Retrieves the layout
43.9 KB
Loading
155 KB
Loading
77.8 KB
Loading

0 commit comments

Comments
 (0)