Step-by-step Walkthrough to Build the AppTravel.jsx React Application
Step 1. Create the React App Structure
Open your terminal and run the following commands to create and navigate to the project directory:
Open visual studio code and open terminal
Install Bootstrap for styling:
Import Bootstrap in the App.jsx file:
Step 2. Set Up the Components Folder
Inside the src folder, create a new folder named components.
Add the following files inside the components folder:
Header.jsx
TravelEntry.jsx
travelData.js
Step 3. Add the travelData.js File
Add the provided travel data as an array of objects. Example:
Layout Design
APP.jsx Layout
TravelEntry.jsx Layout
marker.png
globe.png
Step 4. Create the Header.jsx Component
This component will display a header with a globe icon and a title.
Structure:
Use a div with Bootstrap classes for a responsive design.
Include a globe icon (use an online icon or Font Awesome).
Example:
Use the d-flex justify-content-center align-items-center Bootstrap classes for alignment.
Set a background color and padding using Bootstrap utility classes.
Step 5. Create the TravelEntry.jsx Component
This component will display individual travel entries within an article container.
Structure:
Use a two-column layout:
Left Column: Display the main image.
Right Column: Include:
Map marker icon, country name, and Google Maps link.
Title, dates, and description text.
Use Bootstrap’s grid system for the layout.
Suggested Bootstrap Classes:
row for the flex-row layout.
col-md-4 for the image column.
col-md-8 for the content column.
Use spacing utilities like mb-3, p-2, etc.
Step 6. Update App.jsx
Import Header, TravelEntry, and travelData.
Map over the travelData array to dynamically render a TravelEntry component for each item.
Pass the travel entry data as props to TravelEntry.
Step 7. Applying Bootstrap Styling
Header.jsx:
Add a background color with bg-warning or a custom class.
Use text alignment utilities (text-center) for centering the title.
TravelEntry.jsx:
Use the grid system (row, col) for layout.
Add spacing with utilities (mt-3, p-3, etc.).
Style the map marker and Google Maps link for better visibility.
Step 8. Final Steps
Save all files and start the development server:
Check the following:
The header appears at the top with a globe icon and title.
Each travel entry is displayed in a two-column layout with the provided data.
The application is styled using Bootstrap.
Step 9. Additional Notes
Adjust column widths using Bootstrap’s responsive grid classes (col-sm, col-md, col-lg) for different screen sizes.
Test the links to ensure that they redirect to Google Maps correctly.
Enhance accessibility by adding alt attributes to images and meaningful aria-labels to links.
This procedure ensures you build the application with proper styling using Bootstrap and dynamic rendering using React components. Let me know if you need clarification on any step!
npm create vite@latest
>react-scrimba-travel-app
>React
>JavaScript
cd react-scrimba-travel-app
npm install
npm install bootstrap
import 'bootstrap/dist/css/bootstrap.min.css';
export default [
{
id: 1,
img: {
src: "https://scrimba.com/links/travel-journal-japan-image-url",
alt: "Mount Fuji",
},
title: "Mount Fuji",
country: "Japan",
googleMapsLink: "https://maps.app.goo.gl/6RLYZDuuuqJ7kNGZ9",
dates: "12 Jan, 2021 - 24 Jan, 2021",
text: "Mount Fuji is the tallest mountain in Japan...",
},
// Additional travel entries...
{
id: 2,
img: {
src: "https://scrimba.com/links/travel-journal-australia-image-url",
alt: "Sydney Opera House",
},
title: "Sydney Opera House",
country: "Australia",
googleMapsLink: "https://maps.app.goo.gl/Zr17SCrsJeCEKMd36",
dates: "27 May, 2021 - 8 Jun, 2021",
text: "The Sydney Opera House is a multi-venue performing arts centre in Sydney. Located on the banks of the Sydney Harbour, it is often regarded as one of the 20th century's most famous and distinctive buildings.",
},
{
id: 3,
img: {
src: "https://scrimba.com/links/travel-journal-norway-image-url",
alt: "Geirangerfjord",
},
title: "Geirangerfjord",
country: "Norway",
googleMapsLink: "https://maps.app.goo.gl/fhkJuBhmFDv47tiB7",
dates: "01 Oct, 2021 - 18 Nov, 2021",
text: "The Geiranger Fjord is a fjord in the Sunnmøre region of Møre og Romsdal county, Norway. It is located entirely in the Stranda Municipality.",
},
{
id: 4,
img: {
src: "https://tinyurl.com/2arv9gc3",
alt: "Jumgal",
},
title: "Jumgal Horse Milk",
country: "Kyrgyzstan",
googleMapsLink: "https://maps.app.goo.gl/aivBXpgxMDiaTsb88",
dates: '01 Oct, 2021 - 18 Nov, 2021',
text: 'It is a mountainous district. Its main rivers are the Kökömeren and its tributaries Jumgal, Suusamyr and Batysh Karakol.',
},
{
id: 5,
img: {
src: "https://tinyurl.com/23spwexp",
alt: "Kel-Suu",
},
title: "Kol-Suu , Naryn",
country: "Kyrgyzstan",
googleMapsLink: "https://maps.app.goo.gl/3RzgCZA2yg7VrA53A",
dates: '01 July, 2024 - 04 July, 2024',
text: 'a spectacular glacial lake set in a rocky canyon whose shear sides drop almost straight down into the lake.',
},
];
// Additional travel entries...
// travelData.js
export default [
{
id: 1,
img: {
src: "https://scrimba.com/links/travel-journal-japan-image-url",
alt: "Mount Fuji",
},
title: "Mount Fuji",
country: "Japan",
googleMapsLink: "https://maps.app.goo.gl/6RLYZDuuuqJ7kNGZ9",
dates: "12 Jan, 2021 - 24 Jan, 2021",
text: "Mount Fuji is the tallest mountain in Japan...",
},
// Additional travel entries...
{
id: 2,
img: {
src: "https://scrimba.com/links/travel-journal-australia-image-url",
alt: "Sydney Opera House",
},
title: "Sydney Opera House",
country: "Australia",
googleMapsLink: "https://maps.app.goo.gl/Zr17SCrsJeCEKMd36",
dates: "27 May, 2021 - 8 Jun, 2021",
text: "The Sydney Opera House is a multi-venue performing arts centre in Sydney. Located on the banks of the Sydney Harbour, it is often regarded as one of the 20th century's most famous and distinctive buildings.",
},
{
id: 3,
img: {
src: "https://scrimba.com/links/travel-journal-norway-image-url",
alt: "Geirangerfjord",
},
title: "Geirangerfjord",
country: "Norway",
googleMapsLink: "https://maps.app.goo.gl/fhkJuBhmFDv47tiB7",
dates: "01 Oct, 2021 - 18 Nov, 2021",
text: "The Geiranger Fjord is a fjord in the Sunnmøre region of Møre og Romsdal county, Norway. It is located entirely in the Stranda Municipality.",
},
{
id: 4,
img: {
src: "https://tinyurl.com/2arv9gc3",
alt: "Jumgal",
},
title: "Jumgal Horse Milk",
country: "Kyrgyzstan",
googleMapsLink: "https://maps.app.goo.gl/aivBXpgxMDiaTsb88",
dates: '01 Oct, 2021 - 18 Nov, 2021',
text: 'It is a mountainous district. Its main rivers are the Kökömeren and its tributaries Jumgal, Suusamyr and Batysh Karakol.',
},
{
id: 5,
img: {
src: "https://tinyurl.com/23spwexp",
alt: "Kel-Suu",
},
title: "Kol-Suu , Naryn",
country: "Kyrgyzstan",
googleMapsLink: "https://maps.app.goo.gl/3RzgCZA2yg7VrA53A",
dates: '01 July, 2024 - 04 July, 2024',
text: 'a spectacular glacial lake set in a rocky canyon whose shear sides drop almost straight down into the lake.',
},
];
// Additional travel entries...