pb directory

This commit is contained in:
2026-02-20 12:05:24 +01:00
parent 6cb1a005fd
commit 6d7a783d73
3 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
<!doctype html>
<html>
<head>
<title>Riot todo</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="todo.css">
<script src="todo.riot" type="riot"></script>
<script src="https://unpkg.com/riot@10.1.2/riot+compiler.min.js"></script>
</head>
<body>
<todo />
</body>
<script>
riot.compile().then(() => {
riot.mount('todo', {
title: 'I want to behave!',
todos: [
{ title: 'Avoid excessive caffeine', done: false ,id : 0},
{ title: 'Be less provocative', done: true , id:1},
{ title: 'Be nice to people', done: true, id:2}
]
})
})
</script>
</html>

View File

@@ -0,0 +1,112 @@
body {
font-family: 'myriad pro', sans-serif;
font-size: 20px;
border: 0;
}
todo {
display: block;
max-width: 500px;
margin: 5% auto;
}
form input {
font-size: 85%;
padding: .4em;
border: 1px solid #ccc;
border-radius: 2px;
}
button {
background-color: #1FADC5;
border: 1px solid rgba(0,0,0,.2);
font-size: 75%;
color: #fff;
padding: .4em 1.2em;
border-radius: 2em;
cursor: pointer;
margin: 0 .23em;
outline: none;
}
button[disabled] {
background-color: #ddd;
color: #aaa;
}
ul {
padding: 0;
}
li {
list-style-type: none;
padding: .2em 0;
position: relative;
}
.completed {
text-decoration: line-through;
color: #ccc;
}
label {
cursor: pointer;
}
.filters {
margin-top: 10px;
padding: 0;
list-style: none;
/* position: absolute;*/
right: 0;
left: 0;
}
.filters li {
display: inline;
}
.filters li a,.filters li span {
color: inherit;
/* margin: 3px;*/
margin-right:10px;
padding: 3px 7px;
text-decoration: none;
font-size : 0.75em;
border: 1px solid transparent;
border-radius: 3px;
}
.filters li a:hover {
border-color: rgba(175, 47, 47, 0.1);
}
.filters li a.selected {
border-color: rgba(175, 47, 47, 0.2);
}
li .destroy {
display: none;
position: absolute;
top: 0;
right: 10px;
bottom: 0;
/* width: 40px;
height: 40px;
margin: auto 0;
font-size: 30px;*/
color: #cc9a9a;
/* margin-bottom: 11px;*/
transition: color 0.2s ease-out;
}
li .destroy:hover {
color: #af5b5e;
}
li .destroy:after {
content: '\274c';
}
li:hover .destroy {
display: block;
}

View File

@@ -0,0 +1,63 @@
<todo>
<h3>{ props.title }</h3>
<ul>
<li each={ todo in state.todos } key = {todo.id}>
<label class={ todo.done ? 'completed' : '' }>
<input
type="checkbox"
checked = { todo.done }
onclick = { () => toggle(todo) } />
{ todo.title }
</label>
<span class="destroy" onclick={() => remove(todo)}></span>
</li>
</ul>
<form onsubmit={ add }>
<input oninput={ edit } />
<button disabled={ !state.text }>
Add #{ state.todos.length + 1 }
</button>
<button onclick={ clear }>Clear done</button>
<ul class="filters">
<li><span>0 todos left</span> </li>
<li> <a href="#"> All</a></li>
<li> <a href="#">Active</a></li>
<li> <a href="#">Done</a></li>
</ul>
</form>
<script>
export default {
onBeforeMount(props, state) {
// initial state
this.state = {
todos: props.todos,
text: '',
}
},
edit(e) {
// update only the text state
this.update({
text: e.target.value
})
},
clear(e) {
// TODO
},
add(e) {
// TODO
},
toggle(todo) {
todo.done = !todo.done
this.update()
},
remove(todo){
// TODO
}
}
</script>
</todo>