diff --git a/.github/workflows/azure-deploy.yml b/.github/workflows/azure-deploy.yml new file mode 100644 index 0000000..b43f661 --- /dev/null +++ b/.github/workflows/azure-deploy.yml @@ -0,0 +1,25 @@ + name: Deploy to Azure + on: + push: + branches: + - main + + jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Log in to Azure + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: Build and deploy Container App + uses: azure/container-apps-deploy-action@v1 + with: + appSourcePath: ${{ github.workspace }} + acrName: ${{ vars.AZURE_PREFIX }}acr + resourceGroup: ${{ vars.AZURE_RG }} + containerAppName: ${{ vars.AZURE_PREFIX }}containerapp diff --git a/.github/workflows/create-deploy.yml b/.github/workflows/create-deploy.yml new file mode 100644 index 0000000..8e2e026 --- /dev/null +++ b/.github/workflows/create-deploy.yml @@ -0,0 +1,24 @@ +name: Create Azure resources +on: [workflow_dispatch] +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + + # Checkout codes + - uses: actions/checkout@main + + # Log into Azure + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + # Deploy Bicep file + - name: create resources + uses: azure/arm-deploy@v1 + with: + subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }} + resourceGroupName: ${{ vars.AZURE_RG }} + template: ${{ github.workspace }}/config/main.bicep + parameters: 'namePrefix=${{ vars.AZURE_PREFIX }}' + failOnStdErr: false diff --git a/config/main.bicep b/config/main.bicep index 42e6d0a..c460d0c 100644 --- a/config/main.bicep +++ b/config/main.bicep @@ -108,7 +108,7 @@ resource containerApp 'Microsoft.App/containerApps@2022-03-01' = { configuration: { ingress: { external: true - targetPort: 80 + targetPort: 3000 allowInsecure: false traffic: [ { diff --git a/src/components/Hours.js b/src/components/Hours.js index d51ab5c..0ecdba9 100644 --- a/src/components/Hours.js +++ b/src/components/Hours.js @@ -1 +1,32 @@ -// Placeholder to host a component +import React from "react"; + + const Hours = () => { + // add logic + + const shelterHours = [ + { day: "Monday", open: "10:00", close: "16:00" }, + { day: "Tuesday", open: "10:00", close: "16:00" }, + { day: "Wednesday", open: "10:00", close: "16:00" }, + { day: "Thursday", open: "10:00", close: "16:00" }, + { day: "Friday", open: "10:00", close: "16:00" }, + { day: "Saturday", open: "9:00", close: "20:00" }, + { day: "Sunday", open: "9:00", close: "20:00" }, + + ] + + // get the long day name and store it in a variable called today + const today = new Date().toLocaleDateString('en-US', { weekday: 'long' }); + + // get today's hours + const todayHours = shelterHours.find((day) => day.day === today); + + // display today and the hours in an div with an id of hours + return ( +
+

Horario:

+

{todayHours.day} {todayHours.open} - {todayHours.close}

+
+ ) + } + +export default Hours; diff --git a/src/css/style.css b/src/css/style.css index adf9cf1..18525a9 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -185,3 +185,11 @@ li { h1 { text-align: center; } + +.author { + font-size: 22px; + font-weight: bold; + background: #8e24aa; + color: #fff; + width: 270px; +} diff --git a/src/pages/_app.js b/src/pages/_app.js index 7dd800a..cb1bebe 100644 --- a/src/pages/_app.js +++ b/src/pages/_app.js @@ -7,16 +7,16 @@ function MyApp({ Component, pageProps }) { return ( <> - Pet Care App + Pet Care App - By Carlos Gonzalez
- Home + Inicio - Add Pet + Agregar Mascota
@@ -25,8 +25,11 @@ function MyApp({ Component, pageProps }) { src="https://upload.wikimedia.org/wikipedia/commons/1/1f/Pet_logo_with_flowers.png" alt="pet care logo" > +
+

Autor: Carlos J. Gonzalez

+
-

Adoption shelter

+

Refugio de AdopciĆ³n

diff --git a/src/pages/index.js b/src/pages/index.js index a56f1e8..e9f7653 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -3,6 +3,7 @@ import dbConnect from "../lib/dbConnect"; import Pet from "../models/Pet"; // TODO: Import Hours component +import Hours from "../components/Hours"; const Index = ({ pets }) => { @@ -10,6 +11,7 @@ const Index = ({ pets }) => { <> {/* TODO: Display Hours component */} + {/* Create a card for each pet */} {pets.map((pet) => ( @@ -70,4 +72,4 @@ export async function getServerSideProps() { return { props: { pets: pets } }; } -export default Index; \ No newline at end of file +export default Index;