diff --git a/Facebook_Logo_2023.png b/Facebook_Logo_2023.png new file mode 100644 index 00000000..03056266 Binary files /dev/null and b/Facebook_Logo_2023.png differ diff --git a/Instagram_descarga.jpg b/Instagram_descarga.jpg new file mode 100644 index 00000000..d5e8fdc7 Binary files /dev/null and b/Instagram_descarga.jpg differ diff --git a/LinkedIn_descarga.png b/LinkedIn_descarga.png new file mode 100644 index 00000000..a2ab6638 Binary files /dev/null and b/LinkedIn_descarga.png differ diff --git a/X_descarga.png b/X_descarga.png new file mode 100644 index 00000000..7dc3ca41 Binary files /dev/null and b/X_descarga.png differ diff --git a/bot.png b/bot.png new file mode 100644 index 00000000..2c894b15 Binary files /dev/null and b/bot.png differ diff --git a/index.html b/index.html new file mode 100644 index 00000000..9ff6653c --- /dev/null +++ b/index.html @@ -0,0 +1,98 @@ + + + + + + + + + Chatbot + + + + +
+ + + + +
+ + +
+ Imagen de ejemplo + +
+

Freshly made Pizza

+

Order your best Pizza ever!

+
+
+ + +
+
+ +
+
+

msg

+
+ user bot +
+ + +
+
+

msg

+
+ chat bot +
+
+ +
+
+ + +
+
+ + + + +
+ + + + + + \ No newline at end of file diff --git a/pexels-narda-yescas-724842-1566837.jpg b/pexels-narda-yescas-724842-1566837.jpg new file mode 100644 index 00000000..adfb6661 Binary files /dev/null and b/pexels-narda-yescas-724842-1566837.jpg differ diff --git a/script.js b/script.js new file mode 100644 index 00000000..b86fe22e --- /dev/null +++ b/script.js @@ -0,0 +1,141 @@ +// DOM selectors (variables that point to selected DOM elements) goes here 👇 +const chat = document.getElementById('chat'); +const inputField = document.getElementById('user-input'); +const sendButton = document.getElementById('send-btn'); + +// Variables for order details +let selectedPizza = ''; +let extras = []; +let size = ''; + +// Options for pizzas and extra ingredients +const pizzaOptions = { + Margherita: 10, + Pepperoni: 12, + "Four Cheese": 14, + "Veggie Deluxe": 13 +}; + +const extraOptions = { + "Extra Cheese": 2, + "Mushrooms": 1.5, + "Olives": 1, + "Pepperoni": 2.5 +}; + +// Functions goes here 👇 + +//when website is loaded, chatbot asks the first question +const greetUser = () => { + console.log("Welcome to Maria's Pizza! What type of pizza would you like to order today?", "bot"); + showMessage("Hello!", "user"); +}; + + +// Show pizza options to the user +const showPizzaOptions = () => { + let pizzaList = Object.keys(pizzaOptions).map(pizza => `${pizza} ($${pizzaOptions[pizza]})`).join(', '); + showMessage(`We have the following options: ${pizzaList}`, "bot"); +}; + +// Show extra ingredients options to the user +const showExtraOptions = () => { + let extraList = Object.keys(extraOptions).map(extra => `${extra} ($${extraOptions[extra]})`).join(', '); + showMessage(`Would you like any extra ingredients? Here are the options: ${extraList}. Type 'no' if you don't want extras.`, "bot"); +}; + +// Show size options to the user +const showSizeOptions = () => { + showMessage("Would you like a portion for a child ($5 less) or an adult?", "bot"); +}; + +// Function to handle user input and bot responses +const handleUserInput = () => { + const userInput = inputField.value; + showMessage(userInput, 'user'); + + if (!selectedPizza) { + // Select pizza + if (pizzaOptions[userInput]) { + selectedPizza = userInput; + showExtraOptions(); + } else { + showMessage("Please select a valid pizza option.", "bot"); + } + } else if (extras.length === 0) { + // Select extra ingredients + if (userInput.toLowerCase() === 'no') { + showSizeOptions(); + } else if (extraOptions[userInput]) { + extras.push(userInput); + showMessage(`${userInput} added to your order. Any other extras? (Type 'no' to finish)`, "bot"); + } else { + showMessage("Please select a valid extra ingredient or type 'no'.", "bot"); + } + } else if (!size) { + // Select size + if (userInput.toLowerCase() === 'child') { + size = 'child'; + finalizeOrder(); + } else if (userInput.toLowerCase() === 'adult') { + size = 'adult'; + finalizeOrder(); + } else { + showMessage("Please choose between 'child' or 'adult' portion.", "bot"); + } + } + + inputField.value = ''; // Clear input field after each input +}; + +// Function to finalize the order and show the total price +const finalizeOrder = () => { + let basePrice = pizzaOptions[selectedPizza]; + let extraPrice = extras.reduce((sum, extra) => sum + extraOptions[extra], 0); + let sizeDiscount = size === 'child' ? 5 : 0; + let totalPrice = basePrice + extraPrice - sizeDiscount; + + showMessage(`Great choice! You've ordered a ${selectedPizza} pizza with ${extras.length > 0 ? extras.join(', ') : 'no extras'} for a ${size} portion.`, "bot"); + showMessage(`The total price is $${totalPrice}. Thank you for your order!`, "bot"); +}; + +// Function to show messages in the chat + +const showMessage = (msg, sender) => { + console.log("MESSAGE IS:", msg); + console.log("SENDER IS:", sender); + // The if statement checks if the sender is the user + if (sender === "user") { + chat.innerHTML += `
+
+

${msg}

+
+ user bot +
`; + // The else if statement checks if the sender is the bot + } else if (sender === "bot") { + chat.innerHTML += `
+
+

${msg}

+
+ chat bot +
`; + } + + + chat.scrollTop = chat.scrollHeight; // Auto-scroll to the bottom +}; + + +// Event listeners +sendButton.addEventListener('click', handleUserInput); +inputField.addEventListener('keypress', (event) => { + if (event.key === 'Enter') { + handleUserInput(); + } +}); + + + + + diff --git a/style.css b/style.css new file mode 100644 index 00000000..ee1bf81a --- /dev/null +++ b/style.css @@ -0,0 +1,329 @@ +* { + box-sizing: border-box; +} + +/* Imagen de fondo y secciones */ +body { + margin: 0; + padding: 0; + font-family: 'Montserrat', sans-serif; + background-size: cover; + background-position: center; + height: 100vh; + color: rgb(239, 77, 77); +} + +header { + width: 100%; + position: fixed; + top: 5px; + left: 30px; + color: rgb(245, 139, 139); + padding: 10px 10; + z-index: 1000; +} + +/* Estilo para la barra de navegación */ +nav { + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 30px; +} + +.logo { + font-size: 24px; + font-weight: bold; +} + +.nav-links { + list-style: none; +} + +.nav-links li { + display: inline-block; + margin-left: 220px; +} + +.nav-links a { + color: whitesmoke; + text-decoration: none; + font-size: 18px; + transition: color 0.3s; +} + +.nav-links a:hover { + color: #f0c040; +} + + + + + +/* Sección de bienvenida (Hero Section) */ +.hero { + height: 100vh; + display: flex; + flex-direction: column; + justify-content: flex-end; + align-items: center; + text-align: center; + padding: 5px 5px; + position: relative; + /* Para que el texto se posicione en relación a este contenedor */ +} + +.hero img { + max-width: 100%; + height: 1200px; + margin-bottom: 10px; + border-radius: 5px; + padding-top: 50px; + /* Ajusta este valor para mayor espacio desde arriba */ +} + +.hero h1 { + font-size: 48px; + margin-bottom: 20px; +} + +.hero p { + font-size: 24px; + max-width: 600px; +} + +.overlay-text { + font-weight: bold; + font-size: 28px; + line-height: 34px; + color: rgb(230, 57, 57); + text-align: center; + margin-bottom: 20px; + position: absolute; + /* Posiciona el texto sobre la imagen */ + top: 80%; + /* Ajusta este valor para cambiar la posición vertical del texto */ + left: 50%; + transform: translateX(-50%); + /* Para centrar el texto horizontalmente */ + z-index: 1; + /* Asegura que el texto esté sobre la imagen */ + +} + +/* Adaptar a pantallas más pequeñas */ +@media (max-width: 768px) { + nav { + padding: 0 20px; + } + + nav .nav-links li { + margin-left: 10px; + } + + .hero h1 { + font-size: 36px; + } + + .hero p { + font-size: 18px; + } +} + + +h1 { + font-weight: bold; + font-size: 28px; + line-height: 34px; + color: red; + text-align: center; +} + +h2 { + font-weight: bold; + font-size: 24px; + line-height: 34px; + color: #f38a8a; + text-align: center; + margin-bottom: 36px; +} + +p { + font-size: 18px; + font-weight: 600; + line-height: 28px; + margin: 0; +} + +form { + display: flex; + width: 100%; + align-items: center; +} + +input { + box-sizing: border-box; + border: none; + border-radius: 4px 0 0 4px; + background: #e5e9ff; + color: #0026ff; + padding: 16px; + font-size: 16px; + font-family: 'Montserrat'; + font-weight: 600; + line-height: 26px; + flex: 1; + width: 100%; +} + +main { + margin: 0 auto; + width: 100%; + max-width: 700px; + height: 400px; + border-radius: 30px; + background: rgb(236, 232, 232); + padding: 20px 24px; + padding-top: 0; + box-sizing: border-box; + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.chat { + flex: 1; + display: flex; + justify-content: flex-start; + overflow: scroll; + flex-direction: column; + padding-bottom: 16px; +} + +.bot-msg { + display: flex; + margin: 16px 8px 0 0; + flex-shrink: 0; +} + +.user-msg { + display: flex; + justify-content: flex-end; + margin: 16px 0 0 8px; + flex-shrink: 0; +} + +.bot-msg img, +.user-msg img { + width: 60px; + height: 60px; +} + +.bubble { + background: #e5e9ff; + font-weight: 600; + font-size: 16px; + line-height: 26px; + padding: 16px 24px; + color: #0026ff; + max-width: 40%; +} + +.bot-bubble { + border-radius: 0px 26px 26px 26px; + margin-left: 8px; +} + +.user-bubble { + border-radius: 26px 0 26px 26px; + margin-right: 8px; +} + +.input-wrapper { + display: flex; + justify-content: center; +} + +.input-wrapper form { + width: 100%; + display: flex; + align-items: center; +} + +label { + font-size: 16px; + font-family: 'Montserrat'; + font-weight: 500; + color: #0026ff; + margin-right: 20px; +} + +button { + background-color: #0026ff; + color: white; + border: none; + border-radius: 4px; + padding: 16px 20px; + margin-right: 4px; + font-size: 16px; + line-height: 26px; + font-family: 'Montserrat'; + font-weight: 500; + cursor: pointer; + transition: all 0.3s ease; +} + +button:hover { + opacity: 0.9; + transition: all 0.2s ease; +} + + +.footer { + display: flex; + flex-direction: column; + align-items: center; + padding: 20px 0; + background-color: white; + /* Color del fondo del footer */ + margin-top: 30px; + /* Espacio de 30px entre el footer y el box anterior */ +} + +.social-links { + display: flex; + gap: 20px; + /* Espacio entre los iconos de redes sociales */ + margin-bottom: 20px; + /* Espacio entre las redes sociales y los enlaces legales */ +} + +.social-links a img { + width: 20px; + /* Tamaño de los iconos de redes sociales */ + height: 20px; + transition: transform 0.3s ease; +} + +.social-links a img:hover { + transform: scale(1.1); + /* Efecto de agrandado al pasar el mouse */ +} + +.legal-links { + display: flex; + gap: 15px; + /* Espacio entre los enlaces legales */ +} + +.legal-links a { + font-size: 14px; + color: #333; + /* Color de los enlaces */ + text-decoration: none; +} + +.legal-links a:hover { + text-decoration: underline; + /* Subrayado al pasar el mouse */ +} \ No newline at end of file diff --git a/user.png b/user.png new file mode 100644 index 00000000..6d95f08f Binary files /dev/null and b/user.png differ