Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated with-ionic-typescript example to utilize the App Router. #73418

Merged
merged 25 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4df334f
updated with-ionic-typescript example to utilize the App Router.
PapatMayuri Dec 2, 2024
c883bd9
Merge branch 'canary' into update_with-ionic-typescript_example
PapatMayuri Dec 2, 2024
514a74b
Merge branch 'canary' into update_with-ionic-typescript_example
PapatMayuri Dec 3, 2024
14edfc3
Merge branch 'canary' into update_with-ionic-typescript_example
PapatMayuri Dec 3, 2024
a24050a
Merge branch 'canary' into update_with-ionic-typescript_example
PapatMayuri Dec 3, 2024
d31c5e1
updated PR as per comment.
PapatMayuri Dec 3, 2024
9d5b69f
merging canary.
PapatMayuri Dec 3, 2024
b757325
Merge branch 'canary' into update_with-ionic-typescript_example
PapatMayuri Dec 4, 2024
854637b
Merge branch 'canary' into update_with-ionic-typescript_example
PapatMayuri Dec 4, 2024
3270e01
conflicts resolved.
PapatMayuri Dec 9, 2024
7824cd6
changes as per comment.
PapatMayuri Dec 9, 2024
9145037
Merge branch 'canary' into update_with-ionic-typescript_example
samcx Dec 9, 2024
44c8e36
chore(examples): update tsconfig.json
samcx Dec 9, 2024
2aa0d8c
chore(examples): bump packages
samcx Dec 9, 2024
00592d3
chore(examples): update .gitignore
samcx Dec 9, 2024
edc3b14
chore(examples): update README.md
samcx Dec 9, 2024
5186800
chore(examples): update next config
samcx Dec 9, 2024
bfddf64
chore(examples): update /public
samcx Dec 9, 2024
bf6b571
chore(examples): switch to with-ionic
samcx Dec 9, 2024
9b2b103
chore(examples): update README.md
samcx Dec 9, 2024
11ac915
chore(examples): update turbopack-dev-examples.manifest.json
samcx Dec 9, 2024
30e6293
Merge branch 'canary' into update_with-ionic-typescript_example
samcx Dec 9, 2024
9e81bda
Merge branch 'canary' into update_with-ionic-typescript_example
samcx Dec 9, 2024
5bb7085
Merge branch 'canary' into update_with-ionic-typescript_example
samcx Dec 10, 2024
2a1d354
chore(examples): remove with-next-sass/next-env.d.ts
samcx Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions examples/with-ionic-typescript/next.config.js

This file was deleted.

21 changes: 0 additions & 21 deletions examples/with-ionic-typescript/package.json

This file was deleted.

44 changes: 0 additions & 44 deletions examples/with-ionic-typescript/pages/_app.tsx

This file was deleted.

32 changes: 0 additions & 32 deletions examples/with-ionic-typescript/pages/index.tsx

This file was deleted.

4 changes: 0 additions & 4 deletions examples/with-ionic-typescript/public/vercel.svg

This file was deleted.

19 changes: 0 additions & 19 deletions examples/with-ionic-typescript/tsconfig.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage
Expand All @@ -24,6 +28,7 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# Ionic with TypeScript Example

Example app using Next.js with [Ionic](https://ionicframework.com/) and [TypeScript](https://www.typescriptlang.org/). You can learn more about Ionic in the [documentation](https://ionicframework.com/docs).
Example app using Next.js with [Ionic](https://ionicframework.com/). You can learn more about Ionic in the [documentation](https://ionicframework.com/docs).

## Deploy your own

Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) or preview live with [StackBlitz](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/with-ionic-typescript)
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) or preview live with [StackBlitz](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/with-ionic)

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-ionic-typescript&project-name=with-ionic-typescript&repository-name=with-ionic-typescript)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-ionic&project-name=with-ionic&repository-name=with-ionic)

## How to use

Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:

```bash
npx create-next-app --example with-ionic-typescript with-ionic-typescript-app
npx create-next-app --example with-ionic with-ionic-app
```

```bash
yarn create next-app --example with-ionic-typescript with-ionic-typescript-app
yarn create next-app --example with-ionic with-ionic-app
```

```bash
pnpm create next-app --example with-ionic-typescript with-ionic-typescript-app
pnpm create next-app --example with-ionic with-ionic-app
```

Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
35 changes: 35 additions & 0 deletions examples/with-ionic/_components/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import Image from "next/image";

type CardProps = {
imageSrc: string;
title: string;
subtitle: string;
content: string;
};

export default function Card({
imageSrc,
title,
subtitle,
content,
}: CardProps) {
return (
<ion-card>
<Image
src={imageSrc}
alt={`Image of ${title}`}
width={320}
height={320}
priority={true}
/>
<ion-card-header>
<ion-card-subtitle>{subtitle}</ion-card-subtitle>
<ion-card-title>{title}</ion-card-title>
</ion-card-header>
<ion-card-content>
<ion-icon name="pin" slot="start"></ion-icon>
{content}
</ion-card-content>
</ion-card>
);
}
30 changes: 30 additions & 0 deletions examples/with-ionic/_components/IonicLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"use client";

import React, { useEffect } from "react";
import { defineCustomElements as ionDefineCustomElements } from "@ionic/core/loader";

export default function IonicLayout({
children,
}: {
children: React.ReactNode;
}) {
useEffect(() => {
ionDefineCustomElements(window);
}, []);

return (
<ion-app>
<ion-header translucent>
<ion-toolbar>
<ion-title>Next.js with Ionic</ion-title>
</ion-toolbar>
</ion-header>
<ion-content fullscreen>{children}</ion-content>
<ion-footer>
<ion-toolbar>
<ion-title>Footer</ion-title>
</ion-toolbar>
</ion-footer>
</ion-app>
);
}
22 changes: 22 additions & 0 deletions examples/with-ionic/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import "@ionic/core/css/core.css";
import "@ionic/core/css/normalize.css";
import "@ionic/core/css/structure.css";
import "@ionic/core/css/typography.css";
import "@ionic/core/css/padding.css";
import "@ionic/core/css/float-elements.css";
import "@ionic/core/css/text-alignment.css";
import "@ionic/core/css/text-transformation.css";
import "@ionic/core/css/flex-utils.css";
import "@ionic/core/css/display.css";

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
31 changes: 31 additions & 0 deletions examples/with-ionic/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import IonicLayout from "@/_components/IonicLayout";
import CardComponent from "@/_components/Card";

export default function Home() {
const destinations = new Array(8).fill({
imageSrc: "/img/cat.jpg",
title: "Madison, WI",
subtitle: "Destination",
content:
"Keep close to Nature's heart... and break clear away, once in awhile, and climb a mountain or spend a week in the woods. Wash your spirit clean.",
});

return (
<IonicLayout>
<ion-grid>
<ion-row>
{destinations.map((destination, i) => (
<ion-col key={i} size="3">
<CardComponent
imageSrc={destination.imageSrc}
title={destination.title}
subtitle={destination.subtitle}
content={destination.content}
/>
</ion-col>
))}
</ion-row>
</ion-grid>
</IonicLayout>
);
}
7 changes: 7 additions & 0 deletions examples/with-ionic/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */
};

export default nextConfig;
20 changes: 20 additions & 0 deletions examples/with-ionic/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@ionic/core": "^8.4.1",
"ionicons": "^7.4.0",
"next": "latest",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/node": "^22.10.1",
"@types/react": "^19.0.1",
"typescript": "^5.7.2"
}
}
1 change: 1 addition & 0 deletions examples/with-ionic/public/svg/pin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions examples/with-ionic/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion test/turbopack-dev-examples-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"with-http2": true,
"with-i18n-next-intl": true,
"with-i18n-rosetta": true,
"with-ionic-typescript": true,
"with-ionic": true,
"with-iron-session": true,
"with-jest": true,
"with-jest-babel": true,
Expand Down
Loading