Merge branch 'frontend/basics' into 'main'

feat: frontend basics filled

See merge request EmmaVandewalle/writand!29
This commit is contained in:
Robin Meersman 2024-07-24 20:18:16 +00:00
commit 1538e34603
5 changed files with 45 additions and 10 deletions

View file

@ -20,7 +20,7 @@ class MainActivity : ComponentActivity() {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
color = MaterialTheme.colors.primary
) {
Greeting("Android")
}

View file

@ -0,0 +1,34 @@
package be.re.writand.screens.components
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Button
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import be.re.writand.ui.theme.MainGreen
/**
* A standard button with predefined color and shape.
* @param[text] the text that should be shown in the button.
* @param[onClick] the callback function to execute when the button is clicked.
* @param[enabled] boolean to express if the button is enabled to be clicked or not.
*/
@Composable
fun WritandButton(
text: String,
onClick: () -> Unit,
enabled: Boolean = true
) {
Button(
onClick = onClick,
colors = ButtonDefaults.buttonColors(backgroundColor = MainGreen),
shape = RoundedCornerShape(10.dp),
enabled = enabled
) {
Text(text = text, color = Color.Black, modifier = Modifier.padding(5.dp))
}
}

View file

@ -10,13 +10,15 @@ import androidx.compose.ui.graphics.Color
private val DarkColorPalette = darkColors(
primary = MainGrey,
primaryVariant = VariantDarkGrey,
secondary = MainGreen
secondary = MainGreen,
onBackground = Color.White
)
private val LightColorPalette = lightColors(
primary = Color.White,
primaryVariant = VariantLightGrey,
secondary = MainGreen
secondary = MainGreen,
onBackground = Color.Black
/* Other default colors to override
background = Color.White,
@ -40,6 +42,6 @@ fun WritandTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composabl
colors = colors,
typography = Typography,
shapes = Shapes,
content = content
content = content,
)
}

View file

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="main_green">#FF13CE66</color>
<color name="main_grey">#FF3F3F3F</color>
<color name="variant_dark_grey">#FF4F4F4F</color>
<color name="variant_light_grey">#FFE3E3E3</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>

View file

@ -2,6 +2,6 @@
<resources>
<style name="Theme.Writand" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:statusBarColor">@color/purple_700</item>
<item name="android:statusBarColor">@color/main_green</item>
</style>
</resources>