Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
5ebee5f5
Unverified
Commit
5ebee5f5
authored
Feb 25, 2022
by
Lee Robinson
Committed by
GitHub
Feb 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some minor adjustments to MySQL example. (#34792)
parent
3ee458e3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
10 deletions
+11
-10
README.md
examples/with-mysql/README.md
+1
-1
Product.js
examples/with-mysql/components/Product.js
+4
-3
data.js
examples/with-mysql/prisma/data.js
+6
-6
astronaut-suit.jpg
examples/with-mysql/public/images/astronaut-suit.jpg
+0
-0
placeholder.jpg
examples/with-mysql/public/images/placeholder.jpg
+0
-0
No files found.
examples/with-mysql/README.md
View file @
5ebee5f5
...
@@ -75,7 +75,7 @@ Push the database schema to your PlanetScale database using Prisma.
...
@@ -75,7 +75,7 @@ Push the database schema to your PlanetScale database using Prisma.
Run the seed script to populate your database with
`Product`
and
`Category`
data.
Run the seed script to populate your database with
`Product`
and
`Category`
data.
`np
x
run seed`
`np
m
run seed`
## Run the App
## Run the App
...
...
examples/with-mysql/components/Product.js
View file @
5ebee5f5
...
@@ -5,13 +5,14 @@ export default function Product({ product }) {
...
@@ -5,13 +5,14 @@ export default function Product({ product }) {
return
(
return
(
<
div
<
div
className
=
"max-w-
xs
rounded overflow-hidden shadow-lg"
className
=
"max-w-
[250px]
rounded overflow-hidden shadow-lg"
key
=
{
product
.
id
}
key
=
{
product
.
id
}
>
>
<
Image
<
Image
className
=
"w-full"
className
=
"w-full"
width
=
{
320
}
width
=
{
250
}
height
=
{
160
}
height
=
{
250
}
objectFit
=
"cover"
src
=
{
image
}
src
=
{
image
}
alt
=
{
name
}
alt
=
{
name
}
/
>
/
>
...
...
examples/with-mysql/prisma/data.js
View file @
5ebee5f5
...
@@ -17,31 +17,31 @@ const categories = [
...
@@ -17,31 +17,31 @@ const categories = [
const
products
=
[
const
products
=
[
{
{
name
:
'Cool h
a
t.'
,
name
:
'Cool h
elme
t.'
,
description
:
'A nice h
a
t to wear on your head'
,
description
:
'A nice h
elme
t to wear on your head'
,
price
:
new
Prisma
.
Decimal
(
19.95
),
price
:
new
Prisma
.
Decimal
(
19.95
),
image
:
'/images/
placeholder
.jpg'
,
image
:
'/images/
helmet
.jpg'
,
category_id
:
1
,
category_id
:
1
,
},
},
{
{
name
:
'Grey T-Shirt'
,
name
:
'Grey T-Shirt'
,
description
:
'A nice shirt that you can wear on your body'
,
description
:
'A nice shirt that you can wear on your body'
,
price
:
new
Prisma
.
Decimal
(
22.95
),
price
:
new
Prisma
.
Decimal
(
22.95
),
image
:
'/images/
placeholder
.jpg'
,
image
:
'/images/
shirt
.jpg'
,
category_id
:
3
,
category_id
:
3
,
},
},
{
{
name
:
'Socks'
,
name
:
'Socks'
,
description
:
'Cool socks that you can wear on your feet'
,
description
:
'Cool socks that you can wear on your feet'
,
price
:
new
Prisma
.
Decimal
(
12.95
),
price
:
new
Prisma
.
Decimal
(
12.95
),
image
:
'/images/
placeholder
.jpg'
,
image
:
'/images/
socks
.jpg'
,
category_id
:
2
,
category_id
:
2
,
},
},
{
{
name
:
'Sweatshirt'
,
name
:
'Sweatshirt'
,
description
:
'Cool sweatshirt that you can wear on your body'
,
description
:
'Cool sweatshirt that you can wear on your body'
,
price
:
new
Prisma
.
Decimal
(
12.95
),
price
:
new
Prisma
.
Decimal
(
12.95
),
image
:
'/images/
placeholder
.jpg'
,
image
:
'/images/
sweatshirt
.jpg'
,
category_id
:
3
,
category_id
:
3
,
},
},
]
]
...
...
examples/with-mysql/public/images/astronaut-suit.jpg
deleted
100644 → 0
View file @
3ee458e3
55.7 KB
examples/with-mysql/public/images/placeholder.jpg
deleted
100644 → 0
View file @
3ee458e3
38 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment