Last active
May 23, 2024 04:59
-
-
Save vlgul/c1dcc747b76d27d1e2a00c6a415ecd74 to your computer and use it in GitHub Desktop.
Practica App Shiny
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(reactR) | |
library(shinydashboard) | |
library(shinydashboardPlus) | |
ui <- dashboardPage( | |
dashboardHeader(title = "Mi página web responsiva"), | |
dashboardSidebar( | |
sidebarMenu( | |
menuItem("Inicio", tabName = "inicio", icon = icon("home")), | |
menuItem("Contacto", tabName = "contacto", icon = icon("envelope")), | |
menuItem("Acerca de", tabName = "acerca_de", icon = icon("info-circle")), | |
menuItem("Salir", icon = icon("sign-out-alt")) | |
#menuSeparator() | |
) | |
), | |
dashboardBody( | |
tabItems( | |
tabItem( | |
tabName = "inicio", | |
h1("Bienvenidos a mi página web"), | |
uiOutput("correo_salida") | |
), | |
tabItem( | |
tabName = "contacto", | |
h1("Contáctanos"), | |
textInput("correo", "Ingresa tu correo electrónico"), | |
actionButton("enviar_correo", "Enviar correo") | |
), | |
tabItem( | |
tabName = "acerca_de", | |
h1("Acerca de nosotros"), | |
p("Somos una empresa dedicada a la creación de páginas web responsivas") | |
) | |
) | |
) | |
) | |
server <- function(input, output) { | |
correo <- reactiveVal("") | |
observeEvent(input$sidebarMenu, { | |
updateTabItems( | |
session = getDefaultReactiveDomain(), | |
"sidebarMenu", | |
input$sidebarMenu | |
) | |
}) | |
observeEvent(input$enviar_correo, { | |
correo(input$correo) | |
}) | |
output$correo_salida <- renderUI({ | |
h3(paste("Tu correo electrónico es: ", correo())) | |
}) | |
} | |
shinyApp(ui = ui, server = server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment