-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from MahmoudMabrok/feat/repoUI
feat: ui for repo
- Loading branch information
Showing
20 changed files
with
10,772 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
composeApp/src/commonMain/kotlin/tools/mo3ta/githubactivity/App.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,4 @@ | ||
package tools.mo3ta.githubactivity | ||
|
||
import androidx.compose.runtime.Composable | ||
import cafe.adriel.voyager.navigator.Navigator | ||
import tools.mo3ta.githubactivity.screens.config.ConfigScreen | ||
import tools.mo3ta.githubactivity.theme.CommonTheme | ||
|
||
@Composable | ||
internal fun AppWithCommonTheme() = CommonTheme { | ||
AppContent() | ||
} | ||
|
||
@Composable | ||
internal fun AppContent() = Navigator(ConfigScreen) | ||
|
||
|
||
internal expect fun openUrl(url: String?) |
14 changes: 14 additions & 0 deletions
14
composeApp/src/commonMain/kotlin/tools/mo3ta/githubactivity/AppFiles.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package tools.mo3ta.githubactivity | ||
|
||
import androidx.compose.runtime.Composable | ||
import cafe.adriel.voyager.navigator.Navigator | ||
import tools.mo3ta.githubactivity.screens.config.ConfigScreen | ||
import tools.mo3ta.githubactivity.theme.CommonTheme | ||
|
||
@Composable | ||
internal fun AppWithCommonTheme() = CommonTheme { | ||
AppContent() | ||
} | ||
|
||
@Composable | ||
internal fun AppContent() = Navigator(ConfigScreen) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
composeApp/src/commonMain/kotlin/tools/mo3ta/githubactivity/components/LabelWithIcon.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package tools.mo3ta.githubactivity.components | ||
|
||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.unit.dp | ||
|
||
@Composable | ||
fun LabelWithIcon( | ||
modifier: Modifier = Modifier, | ||
label: String, | ||
iconSource: ImageVector | ||
) { | ||
Row( | ||
modifier = modifier.padding(horizontal = 4.dp) | ||
) { | ||
Icon( | ||
iconSource, | ||
contentDescription = "" | ||
) | ||
Text(label) | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
composeApp/src/commonMain/kotlin/tools/mo3ta/githubactivity/components/RepoItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package tools.mo3ta.githubactivity.components | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.ForkRight | ||
import androidx.compose.material.icons.filled.Star | ||
import androidx.compose.material3.Card | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import tools.mo3ta.githubactivity.model.RepoDetails | ||
|
||
@Composable | ||
fun RepoItem(repoDetails: RepoDetails) { | ||
Card( | ||
modifier = Modifier.fillMaxWidth().padding | ||
(bottom = 16.dp, start = 16.dp, end = 16.dp) | ||
) { | ||
Column(modifier = Modifier.padding(8.dp)) { | ||
repoDetails.name?.let { | ||
Text( | ||
text = it, | ||
style = MaterialTheme.typography.titleLarge | ||
) | ||
} | ||
repoDetails.description?.let { | ||
Text( | ||
text = it, | ||
style = MaterialTheme.typography.bodySmall | ||
) | ||
} | ||
Row { | ||
Text( | ||
text = repoDetails.language ?: "", | ||
style = MaterialTheme.typography.bodySmall, | ||
modifier = Modifier | ||
.width(80.dp) | ||
.align(Alignment.CenterVertically) | ||
) | ||
repoDetails.stargazers_count?.let { | ||
LabelWithIcon( | ||
label = it.toString(), | ||
iconSource = Icons.Default.Star | ||
) | ||
} | ||
repoDetails.forks_count?.let { | ||
LabelWithIcon( | ||
label = it.toString(), | ||
iconSource = Icons.Default.ForkRight | ||
) | ||
} | ||
|
||
} | ||
|
||
} | ||
} | ||
|
||
|
||
} |
14 changes: 14 additions & 0 deletions
14
composeApp/src/commonMain/kotlin/tools/mo3ta/githubactivity/components/RepoList.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package tools.mo3ta.githubactivity.components | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.runtime.Composable | ||
import tools.mo3ta.githubactivity.model.RepoDetails | ||
|
||
@Composable | ||
fun RepoList(repos: List<RepoDetails>) { | ||
Column { | ||
repos.map { | ||
RepoItem(it) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.