commit d0fa7eb4496eb949353a42e2b6a8ee91f3d0394af9ad7f527623bc9c79f072ba Author: William Cardoso Simas Date: Wed Nov 18 10:07:26 2026 -0300 first commit diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..619390e --- /dev/null +++ b/Readme.md @@ -0,0 +1,27 @@ +## AluraFlix 2 + +Projeto desenvolvido na imersão JavaScript da Alura, realizada entre os dias 13/11/2023 e 17/11/2023. Trata-se de uma galeria de filmes. Este projeto foi desenvolvido no quarto dia da imersão (16/11/2023). Embora seja uma continuação do projeto desenvolvido no terceiro dia, optou-se por não colocá-lo em um segundo branch para facilitar a visualização. + +# Conteúdo da aula +Criação de funções javascript e integração com HTML através de eventos, getElementById() e innerHTML. + +# Desafios +Os desafios foram atividades deixadas ao fim da aula para serem resolvidas. + + + +# Melhorias +As melhorias são itens incluídos no projeto e que não foram solicitados nas aulas ou desafios. + + + diff --git a/img/alura-logo.svg b/img/alura-logo.svg new file mode 100644 index 0000000..1c6fb30 --- /dev/null +++ b/img/alura-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/dia-04-aluraflix-e-filmes.png b/img/dia-04-aluraflix-e-filmes.png new file mode 100644 index 0000000..d07b3b6 Binary files /dev/null and b/img/dia-04-aluraflix-e-filmes.png differ diff --git a/img/icone.png b/img/icone.png new file mode 100644 index 0000000..c9d4093 Binary files /dev/null and b/img/icone.png differ diff --git a/img/logo-imersao-aluraflix.svg b/img/logo-imersao-aluraflix.svg new file mode 100644 index 0000000..21821a0 --- /dev/null +++ b/img/logo-imersao-aluraflix.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/splash.png b/img/splash.png new file mode 100644 index 0000000..44f142b Binary files /dev/null and b/img/splash.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..50912e0 --- /dev/null +++ b/index.html @@ -0,0 +1,36 @@ + + + + + + + + + Imersão Dev + + + +
+

+ Aluraflix +

+ +

+ Qual seu filme favorito? +

+
+ + + + +
+
+
+ + + + + + + + \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..d823e17 --- /dev/null +++ b/script.js @@ -0,0 +1,89 @@ + +var filmes = []; + +function adicionarFilme() { + var extensoesImagens = ["jpg", "jpeg", "png", "bmp", "gif", "svg", "webp"]; + + var elementoLinkPoster = document.getElementById('filme'); + var linkPoster = elementoLinkPoster.value; + + var elementoNomeFilme = document.getElementById("nome"); + var textoNome = elementoNomeFilme.value; + + var elementoTrailerFilme = document.getElementById("trailer"); + var linkTrailer = elementoTrailerFilme.value; + + + if (textoNome == "") { + alert("Preencha o nome do filme!"); + return; + } + else if (linkPoster == "") { + alert("Preencha o link do poster!"); + return; + } + else if (linkTrailer == "") { + alert("Preencha o link do trailer do filme!"); + return; + } + + var ehImagem = false; + extensoesImagens.forEach(element => { + if (linkPoster.toLowerCase().endsWith("." + element)) { + ehImagem = true; + } + }); + + if (!ehImagem) { + var textoAlerta = "Informe uma imagem válida! Extensões permitidas: "; + for (var i = 0; i < extensoesImagens.length; i++) { + if (i > 0 && i < extensoesImagens.length - 1) { + textoAlerta += ", "; + } + else if (i == extensoesImagens.length - 1 && i > 0) { + textoAlerta += " e "; + } + + textoAlerta += "." + extensoesImagens[i]; + } + + alert(textoAlerta); + } + else { + var filme = []; + filme["nome"] = textoNome; + filme["poster"] = linkPoster; + filme["trailer"] = linkTrailer; + + filmes.push(filme); + + exibirFilmes(); + + elementoNomeFilme.value = ""; + elementoLinkPoster.value = ""; + elementoTrailerFilme.value = ""; + } +} + +function excluirFilme(id) { + var auxId = id.split("_"); + var indice = parseInt(auxId[1], 10) + filmes.splice(indice, 1); + exibirFilmes(); +} + +function exibirFilmes() { + var htmlFilmes = ""; + for (var i = 0; i < filmes.length; i++) { + htmlFilmes += '
'; + htmlFilmes += ''; + htmlFilmes += ''; + htmlFilmes += ''; + htmlFilmes += ''; + htmlFilmes += '

' + filmes[i]["nome"] + '

'; + htmlFilmes += '
'; + } + + var elementoFilmes = document.getElementById("listaFilmes"); + elementoFilmes.innerHTML = htmlFilmes; +} \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..226888e --- /dev/null +++ b/style.css @@ -0,0 +1,123 @@ +body { + font-family: "Roboto Mono", monospace; + text-align: center; + background-image: url("img/dia-04-aluraflix-e-filmes.png"); + background-color: #000000; + background-size: cover; + background-position: center top; + background-repeat: no-repeat; +} + +.container { + text-align: center; + padding: 10px; +} + +.page-title { + color: #ffffff; + margin: 0 0 5px; +} + +.page-subtitle { + color: #ffffff; + margin-top: 5px; +} + +.page-logo { + width: 200px; +} + +.alura-logo { + width: 40px; + position: absolute; + top: 10px; + right: 10px; +} + +#listaFilmes img { + margin-top: 0px; + margin-bottom: 0px; + margin-left: auto; + margin-right: auto; + max-height: 250px; + border-radius: 10px; +} + +#listaFilmes +{ + /*background-color: #da1e26;*/ + display: flex; + justify-content: center; + flex-direction: row; +} + +.form-wrapper { + margin-top: 0px; + margin-bottom: 0px; + margin-left:auto; + margin-right: auto; +} + +.form-wrapper input { + display: block; + margin-top: 3px; + margin-bottom: 0px; + margin-left: auto; + margin-right: auto; + padding: 10px 15px; +} + +.form-wrapper button { + border: 0; + color: #ffffff; + background: #da1e26; + font-weight: bold; + padding: 15px 20px; + font-size: 16px; + border-radius: 4px; + margin-top: 20px; + cursor: pointer; + transition: 0.3s; +} + +.form-wrapper button:hover { + opacity: 0.8; +} + +input +{ + margin-top: 20px; +} + +.filmeEspecifico +{ + margin-left: 5px; + margin-right: 5px; + border-radius: 10px; + padding: 10px; + background-color: rgba(0, 0, 0, 0.3); + width: fit-content; +} + +.filmeEspecifico>p{ + margin-top: 0px; + margin-bottom: 0px; + margin-left: 0px; + margin-right: 0px; + color: white; +} + +.botaoExcluir +{ + border-radius: 20px; + width: fit-content; + height: fit-content; + box-shadow: none; + display: block; + position: relative; + top: -5px;; + right: 0; + left: 90%; + background-color: white; + border: #ffffff; +} \ No newline at end of file