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