Some changes
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
"bundle": {
|
"bundle": {
|
||||||
"active": true,
|
"active": true,
|
||||||
"targets": "all",
|
"targets": "all",
|
||||||
"identifier": "com.tauri.dev",
|
"identifier": "minesweeper",
|
||||||
"icon": [
|
"icon": [
|
||||||
"icons/32x32.png",
|
"icons/32x32.png",
|
||||||
"icons/128x128.png",
|
"icons/128x128.png",
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ impl Component for App {
|
|||||||
type Properties = ();
|
type Properties = ();
|
||||||
|
|
||||||
fn create(ctx: &Context<Self>) -> Self {
|
fn create(ctx: &Context<Self>) -> Self {
|
||||||
let mut game = Game::new(25, 40, 50);
|
let mut game = Game::new(10, 10, 5);
|
||||||
game.start_board();
|
game.start_board();
|
||||||
|
|
||||||
info!("\n{}", game.get_board().to_string());
|
info!("\n{}", game.get_board().to_string());
|
||||||
|
|||||||
@@ -62,10 +62,10 @@ impl Component for BoardComponent {
|
|||||||
match msg {
|
match msg {
|
||||||
Msg::Discover {cell} => {
|
Msg::Discover {cell} => {
|
||||||
// info!("Pos (from board): {}", format!("{:?}", cell.get_pos()));
|
// info!("Pos (from board): {}", format!("{:?}", cell.get_pos()));
|
||||||
self.onsignal.emit(cell)
|
self.onsignal.emit(cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
true
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn changed(&mut self, ctx: &Context<Self>, _old_props: &Self::Properties) -> bool {
|
fn changed(&mut self, ctx: &Context<Self>, _old_props: &Self::Properties) -> bool {
|
||||||
|
|||||||
@@ -37,9 +37,15 @@ impl Component for Button {
|
|||||||
fn view(&self, ctx: &Context<Self>) -> Html {
|
fn view(&self, ctx: &Context<Self>) -> Html {
|
||||||
|
|
||||||
html!{
|
html!{
|
||||||
<button class={if self.cell.is_hidden() {"button-hidden"} else {"button-shown"} } onclick={self.link.callback(|_| Msg::Clicked)}>
|
|
||||||
|
<button
|
||||||
|
class={if self.cell.is_hidden() {"button-hidden"} else {"button-shown"}}
|
||||||
|
onclick={self.link.callback(|_| Msg::Clicked)}
|
||||||
|
// oncontextmenu={self.link.callback(|_| Msg::Clicked)}
|
||||||
|
oncontextmenu={self.link.callback(|_| Msg::Clicked)}>
|
||||||
{ &self.cell.to_string() }
|
{ &self.cell.to_string() }
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,10 +53,10 @@ impl Component for Button {
|
|||||||
match msg {
|
match msg {
|
||||||
Msg::Clicked => {
|
Msg::Clicked => {
|
||||||
// info!("hid (from cell): {}", format!("{:?}", self.cell.is_hidden()));
|
// info!("hid (from cell): {}", format!("{:?}", self.cell.is_hidden()));
|
||||||
self.onsignal.emit(self.cell)
|
self.onsignal.emit(self.cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
true
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn changed(&mut self, ctx: &Context<Self>, _old_props: &Self::Properties) -> bool {
|
fn changed(&mut self, ctx: &Context<Self>, _old_props: &Self::Properties) -> bool {
|
||||||
|
|||||||
37
styles.css
37
styles.css
@@ -1,9 +1,9 @@
|
|||||||
:root {
|
:root {
|
||||||
font-family: Courier , Avenir, Helvetica, Arial, sans-serif;
|
font-family: Verdana, Geneva, Tahoma, sans-serif;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
/* Verdana , Avenir, Helvetica, Arial, sans-serif */
|
||||||
color: #0f0f0f;
|
color: #0f0f0f;
|
||||||
background-color: #f6f6f6;
|
background-color: #f6f6f6;
|
||||||
|
|
||||||
@@ -22,9 +22,10 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 10vh;
|
padding: 10vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
/* flex-direction: column; */
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
@@ -66,16 +67,14 @@ button {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
/* padding: 16px; */
|
|
||||||
/* font-size: 1em; */
|
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-family: inherit;
|
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
background-color: #0f0f0f98;
|
background-color: #0f0f0f98;
|
||||||
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
|
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
|
||||||
height: 50px;
|
height: 50px;
|
||||||
width: 50px;
|
width: 50px;
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
|
transition: background-color 0.5s;
|
||||||
-webkit-transition: background-color 0.5s;
|
-webkit-transition: background-color 0.5s;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -85,30 +84,32 @@ button {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
/* padding: 16px; */
|
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-family: inherit;
|
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
background-color: #2f2f2f;
|
background-color: #2f2f2f;
|
||||||
/* transition: border-color 0.25s; */
|
|
||||||
/* box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2); */
|
|
||||||
height: 50px;
|
height: 50px;
|
||||||
width: 50px;
|
width: 50px;
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.button-hidden:hover {
|
.button-hidden:hover {
|
||||||
background-color: #333333;
|
background-color: #262626;
|
||||||
|
transition: background-color 0.5s;
|
||||||
-webkit-transition: background-color 0.5s;
|
-webkit-transition: background-color 0.5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
button:active {
|
.button-hidden:active {
|
||||||
border-color: #396cd8;
|
background-color: #2f2f2f;
|
||||||
background-color: #e8e8e8;
|
transition: background-color 0.5s;
|
||||||
|
-webkit-transition: background-color 0.5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-shown:active {
|
||||||
|
background-color: #2f2f2f;
|
||||||
|
transition: background-color 0.5s;
|
||||||
|
-webkit-transition: background-color 0.5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
input,
|
input,
|
||||||
@@ -116,10 +117,6 @@ button {
|
|||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#greet-input {
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
:root {
|
:root {
|
||||||
color: #f6f6f6;
|
color: #f6f6f6;
|
||||||
|
|||||||
Reference in New Issue
Block a user