Skip to content

Commit

Permalink
feat: next-intl@3.22 (#1391)
Browse files Browse the repository at this point in the history
  • Loading branch information
amannn authored Oct 21, 2024
2 parents ae836db + 7b3a9a3 commit 1999163
Show file tree
Hide file tree
Showing 135 changed files with 5,146 additions and 1,308 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: main

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
name: Build, lint, and test
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
- run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- run: pnpm run publish --conventional-prerelease --preid canary --dist-tag canary --no-push
- run: |
sed -i 's/"use-intl": "workspace:\^"/"use-intl": "workspace:"/' ./packages/next-intl/package.json && git commit -am "use fixed version"
- run: pnpm lerna publish 0.0.0-canary-${GITHUB_SHA::7} --no-git-reset --dist-tag canary --no-push --yes
if: "${{startsWith(github.event.head_commit.message, 'fix: ') || startsWith(github.event.head_commit.message, 'feat: ')}}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type Props = Omit<ComponentProps<typeof Link>, 'children'> & {
type?: 'article' | 'video';
};

export default function CommunityLink({
export default function BlogPostLink({
author,
date,
title,
Expand Down
36 changes: 26 additions & 10 deletions docs/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,30 @@ import minLight from 'shiki/themes/min-light.mjs';

const lightTheme = {
...minLight,
tokenColors: minLight.tokenColors.map((color) => {
// Increase the contrast of comments
if (color.scope?.includes('comment')) {
return {...color, settings: {foreground: '#808ea3'}};
} else {
return color;
}
})
tokenColors: minLight.tokenColors
.map((color) => {
// Increase the contrast of comments
if (color.scope?.includes('comment')) {
return {...color, settings: {foreground: '#808ea3'}};
} else {
return color;
}
})
// Add colors for diffs
.concat([
{
scope: 'markup.deleted.diff',
settings: {
foreground: '#D32F2F'
}
},
{
scope: 'markup.inserted.diff',
settings: {
foreground: '#22863A'
}
}
])
};

const withNextra = nextra({
Expand Down Expand Up @@ -150,12 +166,12 @@ export default withNextra({
permanent: true
},
{
source: '/examples/minimal',
source: '/examples/advanced',
destination: '/examples',
permanent: true
},
{
source: '/examples/advanced',
source: '/examples/minimal',
destination: '/examples',
permanent: true
}
Expand Down
Binary file added docs/pages/api/Inter-Regular.otf
Binary file not shown.
54 changes: 43 additions & 11 deletions docs/pages/api/og.tsx → docs/pages/api/og-image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,27 @@ export const config = {
};

export default async function OG(req: Request) {
const inter = await fetch(
const interSemiBold = await fetch(
new URL('./Inter-SemiBold.otf', import.meta.url)
).then((res) => res.arrayBuffer());
const interRegular = await fetch(
new URL('./Inter-Regular.otf', import.meta.url)
).then((res) => res.arrayBuffer());

const {searchParams} = new URL(req.url);

const hasTitle = searchParams.has('title');
let title = hasTitle ? searchParams.get('title')! : siteConfig.title;
const maxLength = 80;
if (title.length > maxLength) {
title = title.slice(0, maxLength) + '...';
let title = siteConfig.title,
subtitle;
if (searchParams.has('params')) {
let params;
try {
params = JSON.parse(searchParams.get('params')!);
} catch {
// Ignore
}
if (params) {
title = params.title || title;
subtitle = params.subtitle;
}
}

return new ImageResponse(
Expand All @@ -28,7 +38,6 @@ export default async function OG(req: Request) {
display: 'flex',
flexDirection: 'column',
alignItems: 'flex-start',
justifyContent: 'space-between',
padding: 80,
backgroundColor: 'white',
fontWeight: 600,
Expand Down Expand Up @@ -118,11 +127,27 @@ export default async function OG(req: Request) {
fontSize: 82,
lineHeight: 1.1,
letterSpacing: -4,
marginRight: 12
marginRight: 12,
marginTop: 'auto',
marginBottom: 0,
fontWeight: 600
}}
>
{title}
</h1>
{subtitle && (
<p
style={{
fontSize: 54,
lineHeight: 1.1,
letterSpacing: -4,
marginRight: 12,
fontWeight: 500
}}
>
{subtitle}
</p>
)}
</div>
),
{
Expand All @@ -131,8 +156,15 @@ export default async function OG(req: Request) {
fonts: [
{
name: 'inter',
data: inter,
style: 'normal'
data: interSemiBold,
style: 'normal',
weight: 600
},
{
name: 'inter',
data: interRegular,
style: 'normal',
weight: 500
}
]
}
Expand Down
14 changes: 10 additions & 4 deletions docs/pages/blog/index.mdx
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
import CommunityLink from 'components/CommunityLink';
import BlogPostLink from 'components/BlogPostLink';

# next-intl blog

<div className="flex flex-col gap-4 py-8">
<CommunityLink
<BlogPostLink
href="/blog/next-intl-3-22"
title="next-intl 3.22: Incrementally moving forward"
date="Oct 21, 2024"
author="By Jan Amann"
/>
<BlogPostLink
href="/blog/date-formatting-nextjs"
title="Reliable date formatting in Next.js"
date="Sep 25, 2024"
author="By Jan Amann"
/>
<CommunityLink
<BlogPostLink
href="/blog/next-intl-3-0"
title="next-intl 3.0"
date="Nov 14, 2023"
author="By Jan Amann"
/>
<CommunityLink
<BlogPostLink
href="/blog/translations-outside-of-react-components"
title="How (not) to use translations outside of React components"
date="Apr 21, 2023"
Expand Down
Loading

0 comments on commit 1999163

Please sign in to comment.