Added new menu icons
This commit is contained in:
parent
1f7c20725c
commit
87b5b49291
@ -1,17 +1,24 @@
|
||||
import androidx.compose.animation.Crossfade
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.OutlinedButton
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.graphics.painter.Painter
|
||||
import androidx.compose.ui.input.pointer.pointerMoveFilter
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.window.*
|
||||
import theme.GitnuroTheme
|
||||
import theme.*
|
||||
import java.awt.FileDialog
|
||||
import java.awt.Frame
|
||||
import javax.swing.JFileChooser
|
||||
import javax.swing.UIManager
|
||||
|
||||
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@ -110,30 +117,76 @@ fun GMenu(
|
||||
.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.Center,
|
||||
) {
|
||||
OutlinedButton(
|
||||
MenuButton(
|
||||
title = "Open",
|
||||
icon = painterResource("open.svg"),
|
||||
onClick = onRepositoryOpen
|
||||
) {
|
||||
Text("Open")
|
||||
}
|
||||
OutlinedButton(
|
||||
onClick = onPull
|
||||
) {
|
||||
Text("Pull")
|
||||
}
|
||||
OutlinedButton(
|
||||
onClick = onPush
|
||||
) {
|
||||
Text("Push")
|
||||
}
|
||||
OutlinedButton(
|
||||
onClick = onStash
|
||||
) {
|
||||
Text("Stash")
|
||||
}
|
||||
OutlinedButton(
|
||||
onClick = onPopStash
|
||||
) {
|
||||
Text("Pop stash")
|
||||
)
|
||||
MenuButton(
|
||||
title = "Pull",
|
||||
icon = painterResource("download.svg"),
|
||||
onClick = onPull,
|
||||
)
|
||||
MenuButton(
|
||||
title = "Push",
|
||||
icon = painterResource("upload.svg"),
|
||||
onClick = onPush,
|
||||
)
|
||||
MenuButton(
|
||||
title = "Stash",
|
||||
icon = painterResource("stash.svg"),
|
||||
onClick = onStash,
|
||||
)
|
||||
MenuButton(
|
||||
title = "Apply",
|
||||
icon = painterResource("apply_stash.svg"),
|
||||
onClick = onPopStash,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun MenuButton(modifier: Modifier = Modifier, title: String, icon: Painter, onClick: () -> Unit) {
|
||||
|
||||
var hovering by remember { mutableStateOf(false) }
|
||||
|
||||
val backgroundColor = if(hovering)
|
||||
MaterialTheme.colors.primary.copy(alpha = 0.15F)
|
||||
else
|
||||
MaterialTheme.colors.primary.copy(alpha = 0F)
|
||||
|
||||
TextButton(
|
||||
modifier = modifier
|
||||
.padding(horizontal = 2.dp)
|
||||
.pointerMoveFilter(
|
||||
onEnter = {
|
||||
hovering = true
|
||||
false
|
||||
},
|
||||
onExit = {
|
||||
hovering = false
|
||||
false
|
||||
}
|
||||
)
|
||||
,
|
||||
onClick = onClick,
|
||||
colors = ButtonDefaults.buttonColors(backgroundColor = backgroundColor)
|
||||
) {
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Image(
|
||||
painter = icon,
|
||||
contentDescription = title,
|
||||
modifier = Modifier
|
||||
.padding(4.dp)
|
||||
.size(24.dp),
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colors.primary),
|
||||
)
|
||||
Text(
|
||||
text = title,
|
||||
fontSize = 12.sp,
|
||||
color = MaterialTheme.colors.primaryTextColor
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
4
src/main/resources/apply_stash.svg
Normal file
4
src/main/resources/apply_stash.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M19 12V19H5V12H3V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V12H19ZM19 12V19H5V12H3V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V12" fill="black"/>
|
||||
<path d="M8.40975 9.41L10.9998 6.83L10.9998 16.5H12.9998L12.9998 6.83L15.5898 9.41L16.9998 8L11.9998 3L6.99975 8L8.40975 9.41Z" fill="black"/>
|
||||
</svg>
|
After Width: | Height: | Size: 408 B |
1
src/main/resources/download.svg
Normal file
1
src/main/resources/download.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/></g><g><path d="M5,20h14v-2H5V20z M19,9h-4V3H9v6H5l7,7L19,9z"/></g></svg>
|
After Width: | Height: | Size: 254 B |
1
src/main/resources/open.svg
Normal file
1
src/main/resources/open.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z"/></svg>
|
After Width: | Height: | Size: 264 B |
1
src/main/resources/upload.svg
Normal file
1
src/main/resources/upload.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/></g><g><path d="M5,20h14v-2H5V20z M5,10h4v6h6v-6h4l-7-7L5,10z"/></g></svg>
|
After Width: | Height: | Size: 255 B |
Loading…
Reference in New Issue
Block a user