Add SearchPage skeleton.
This commit is contained in:
parent
d56daf926d
commit
eacc395195
3 changed files with 107 additions and 45 deletions
|
|
@ -34,10 +34,10 @@ import com.pixelized.biblib.ui.scaffold.rememberSearchScaffoldState
|
||||||
import com.pixelized.biblib.ui.screen.connectivity.ConnectivityViewModel
|
import com.pixelized.biblib.ui.screen.connectivity.ConnectivityViewModel
|
||||||
import com.pixelized.biblib.ui.screen.home.common.composable.ConnectivityHeader
|
import com.pixelized.biblib.ui.screen.home.common.composable.ConnectivityHeader
|
||||||
import com.pixelized.biblib.ui.screen.home.page.Page
|
import com.pixelized.biblib.ui.screen.home.page.Page
|
||||||
import com.pixelized.biblib.ui.screen.home.page.SearchPage
|
|
||||||
import com.pixelized.biblib.ui.screen.home.page.books.BooksPage
|
import com.pixelized.biblib.ui.screen.home.page.books.BooksPage
|
||||||
import com.pixelized.biblib.ui.screen.home.page.news.NewsPage
|
import com.pixelized.biblib.ui.screen.home.page.news.NewsPage
|
||||||
import com.pixelized.biblib.ui.screen.home.page.profile.ProfilePage
|
import com.pixelized.biblib.ui.screen.home.page.profile.ProfilePage
|
||||||
|
import com.pixelized.biblib.ui.screen.home.page.search.SearchPage
|
||||||
import com.pixelized.biblib.ui.theme.BibLibTheme
|
import com.pixelized.biblib.ui.theme.BibLibTheme
|
||||||
import com.pixelized.biblib.utils.extention.bibLib
|
import com.pixelized.biblib.utils.extention.bibLib
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
package com.pixelized.biblib.ui.screen.home.page
|
|
||||||
|
|
||||||
import android.content.res.Configuration.UI_MODE_NIGHT_NO
|
|
||||||
import android.content.res.Configuration.UI_MODE_NIGHT_YES
|
|
||||||
import androidx.compose.foundation.layout.Box
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.material.MaterialTheme
|
|
||||||
import androidx.compose.material.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
|
||||||
import com.pixelized.biblib.ui.theme.BibLibTheme
|
|
||||||
import com.pixelized.biblib.utils.extention.bibLib
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun SearchPage() {
|
|
||||||
SearchPageContent(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(MaterialTheme.bibLib.dimen.dp16)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun SearchPageContent(
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
|
||||||
Box(modifier = modifier) {
|
|
||||||
Text(
|
|
||||||
style = MaterialTheme.typography.h6,
|
|
||||||
text = "SearchPageContent"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
@Preview(uiMode = UI_MODE_NIGHT_NO)
|
|
||||||
@Preview(uiMode = UI_MODE_NIGHT_YES)
|
|
||||||
private fun SearchPageContentPreview() {
|
|
||||||
BibLibTheme {
|
|
||||||
SearchPageContent()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,106 @@
|
||||||
|
package com.pixelized.biblib.ui.screen.home.page.search
|
||||||
|
|
||||||
|
import android.content.res.Configuration.UI_MODE_NIGHT_NO
|
||||||
|
import android.content.res.Configuration.UI_MODE_NIGHT_YES
|
||||||
|
import androidx.compose.foundation.horizontalScroll
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.material.*
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.ArrowDropDown
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import com.pixelized.biblib.ui.theme.BibLibTheme
|
||||||
|
import com.pixelized.biblib.utils.extention.bibLib
|
||||||
|
import com.pixelized.biblib.utils.extention.default
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun SearchPage() {
|
||||||
|
SearchPageContent(
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun SearchPageContent(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
) {
|
||||||
|
LazyColumn(
|
||||||
|
modifier = modifier,
|
||||||
|
verticalArrangement = Arrangement.spacedBy(MaterialTheme.bibLib.dimen.dp8),
|
||||||
|
) {
|
||||||
|
item(key = "Search Filter") {
|
||||||
|
SearchFilter(
|
||||||
|
modifier = Modifier.padding(horizontal = MaterialTheme.bibLib.dimen.dp16)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun SearchFilter(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.horizontalScroll(rememberScrollState())
|
||||||
|
.then(modifier)
|
||||||
|
) {
|
||||||
|
SearchChipFilter(
|
||||||
|
label = "Autheur",
|
||||||
|
selected = true,
|
||||||
|
value = "Isaac Asimov"
|
||||||
|
)
|
||||||
|
SearchChipFilter(
|
||||||
|
modifier = Modifier.padding(horizontal = MaterialTheme.bibLib.dimen.dp8),
|
||||||
|
label = "Genre",
|
||||||
|
)
|
||||||
|
SearchChipFilter(
|
||||||
|
label = "Langue",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterialApi::class)
|
||||||
|
@Composable
|
||||||
|
private fun SearchChipFilter(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
label: String,
|
||||||
|
selected: Boolean = false,
|
||||||
|
value: String? = null,
|
||||||
|
onClick: () -> Unit = default(),
|
||||||
|
) {
|
||||||
|
FilterChip(
|
||||||
|
modifier = modifier,
|
||||||
|
selected = selected,
|
||||||
|
onClick = onClick,
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = label
|
||||||
|
)
|
||||||
|
|
||||||
|
value?.let {
|
||||||
|
Text(text = ": ")
|
||||||
|
Text(text = value)
|
||||||
|
}
|
||||||
|
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Default.ArrowDropDown,
|
||||||
|
contentDescription = null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
@Preview(uiMode = UI_MODE_NIGHT_NO)
|
||||||
|
@Preview(uiMode = UI_MODE_NIGHT_YES)
|
||||||
|
private fun SearchPageContentPreview() {
|
||||||
|
BibLibTheme {
|
||||||
|
SearchPageContent()
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue