Skip to content

Commit

Permalink
refactor(notifications): extract row for notification
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Hoefer committed Dec 17, 2020
1 parent e26d208 commit 51e6c54
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.github.xetra11.ck3workbench.module.character.ui

import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

object MainComponents {
@Composable
fun NotificationPanelRow(
content: @Composable RowScope.() -> Unit
) {
Row(
Modifier.border(3.dp, Color.Yellow)
.fillMaxSize()
.padding(end = 10.dp),
horizontalArrangement = Arrangement.End,
verticalAlignment = Alignment.CenterVertically,
content = content
)
}
}
12 changes: 4 additions & 8 deletions src/main/kotlin/main.kt
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import androidx.compose.desktop.AppManager
import androidx.compose.desktop.AppWindow
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.CutCornerShape
import androidx.compose.material.Colors
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Shapes
import androidx.compose.material.Text
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Alignment
Expand All @@ -24,11 +21,8 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Menu
import androidx.compose.ui.window.MenuBar
import androidx.compose.ui.window.MenuItem
import com.github.xetra11.ck3workbench.module.character.app.NotificationsService
import com.github.xetra11.ck3workbench.module.character.app.NotificationsService.NotificationType.ERROR
import com.github.xetra11.ck3workbench.module.character.app.NotificationsService.NotificationType.NOTIFICATION
import com.github.xetra11.ck3workbench.module.character.app.NotificationsService.NotificationType.WARNING
import com.github.xetra11.ck3workbench.module.character.importer.CharacterScriptImporter
import com.github.xetra11.ck3workbench.module.character.ui.MainComponents
import com.github.xetra11.ck3workbench.module.character.ui.NotificationPanel
import com.github.xetra11.ck3workbench.module.character.ui.WorkbenchFunctions
import com.github.xetra11.ck3workbench.module.character.view.CharacterModuleView
Expand Down Expand Up @@ -85,7 +79,9 @@ fun main() = invokeLater {
CharacterModuleView()
}
}
NotificationPanel()
MainComponents.NotificationPanelRow {
NotificationPanel()
}
}
}
}
Expand Down

0 comments on commit 51e6c54

Please sign in to comment.