-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/AyudaEnPython/Herramientas
- Loading branch information
Showing
5 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// uncomment when using Cirrus headers | ||
// | ||
// document.querySelector(".nav-btn").addEventListener("click", function () { | ||
// document.getElementById("header-menu").classList.toggle("active"); | ||
// this.classList.toggle("active"); | ||
// }); | ||
|
||
function loadConfig() { | ||
fetch("setup.json") | ||
.then((response) => response.json()) | ||
.then((data) => { | ||
document.getElementById("title").textContent = data.title; | ||
document.getElementById("subtitle").textContent = data.subtitle; | ||
}) | ||
.catch((error) => console.error("Error: error loading json", error)); | ||
} | ||
|
||
loadConfig(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<!DOCTYPE html> | ||
<html lang="es"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width,initial-scale=1" /> | ||
<link rel="shortcut icon" href="assets/images/favicon.ico" /> | ||
<title>AyudaEnPython | Demo</title> | ||
<link href="https://unpkg.com/cirrus-ui" type="text/css" rel="stylesheet" /> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@200;300;400;600;700&family=Montserrat:wght@400;700&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" | ||
integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" | ||
crossorigin="anonymous" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="https://pyscript.net/releases/2024.9.1/core.css" | ||
/> | ||
<script | ||
type="module" | ||
src="https://pyscript.net/releases/2024.9.1/core.js" | ||
></script> | ||
</head> | ||
<body> | ||
<py-config> | ||
[[fetch]] | ||
files = ['main.py'] | ||
</py-config> | ||
<py-script> | ||
from pyscript import when, display, document | ||
from main import get_days | ||
|
||
@when("click", "#clear-btn") | ||
def clear_all(event): | ||
document.getElementById("main-input").value = "" | ||
document.getElementById("result").innerHTML = "</br>" | ||
|
||
@when("click", "#show-btn") | ||
def click_handler(event): | ||
name = document.getElementById("main-input").value | ||
result = get_days(name) | ||
document.getElementById("result").innerHTML = result | ||
</py-script> | ||
<div class="hero fullscreen bg-yellow-200"> | ||
<div class="hero-body"> | ||
<div class="mx-auto"> | ||
<h1 class="title uppercase text-indigo-600" id="title"></h1> | ||
<h3 class="subtitle text-gray-600" id="subtitle"></h1> | ||
<!-- Make changes from here --> | ||
<div class="form-group"> | ||
<label class="form-group-label">></label> | ||
<input type="number" id="main-input" class="form-group-input"/> | ||
</div> | ||
<div class="u-center u-gap-2"> | ||
<button id="show-btn">Show</button> | ||
<button id="clear-btn">Clear</button> | ||
</div> | ||
<div class="u-round-xs u-shadow-xl p-3 bg-indigo-200"> | ||
<div class="u-flex u-justify-center u-gap-2"> | ||
<div class="text-indigo-600 font-semibold tracking-looser" id="result"></br></div> | ||
</div> | ||
</div> | ||
<!-- to here --> | ||
</div> | ||
</div> | ||
</div> | ||
<script src="assets/js/main.js"></script> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from datetime import date | ||
|
||
|
||
def get_days(year): | ||
today_ = date.today() | ||
dob = date(int(year), 1, 1) | ||
return (today_ - dob).days |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"title": "Días transcurridos", | ||
"subtitle": "AyudaEnPython" | ||
} |