Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Atomik Composables #39

Merged
merged 1 commit into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.kevinschildhorn.fotopresenter.ui.screens.common.composables

import androidx.compose.material.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import com.kevinschildhorn.atomik.atomic.atoms.interfaces.TextAtom
import com.kevinschildhorn.atomik.color.base.composeColor

@Composable
fun AtomikIcon(
imageVector: ImageVector,
atom: TextAtom,
modifier: Modifier = Modifier,
contentDescription: String
) {
Icon(
imageVector = imageVector,
contentDescription = contentDescription,
tint = atom.textColor.composeColor,
modifier = modifier,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package com.kevinschildhorn.fotopresenter.ui.screens.common.composables
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.kevinschildhorn.atomik.atomic.atoms.interfaces.SimpleTextAtom
import com.kevinschildhorn.atomik.atomic.atoms.interfaces.TextAtom
import com.kevinschildhorn.atomik.atomic.atoms.textStyle
import com.kevinschildhorn.atomik.color.base.composeColor

@Composable
fun AtomikText(text: String, atom: SimpleTextAtom, modifier: Modifier = Modifier) {
fun AtomikText(text: String, atom: TextAtom, modifier: Modifier = Modifier) {
Text(
text,
style = atom.textStyle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ fun ErrorView(
vertical = atom.paddingVertical?.dp ?: 0.dp,
).fillMaxWidth(),
) {
Text(
text = message,
color = atom.textColor.composeColor,
style = atom.textStyle,
)
AtomikText(message,atom)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,5 @@ fun TitleView(
modifier: Modifier = Modifier,
) {
val atom = title(typography = FotoTypography.h3)

Text(
text = value,
color = atom.textColor.composeColor,
style = atom.textStyle,
modifier = modifier,
)
AtomikText(value, atom, modifier)
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.kevinschildhorn.atomik.atomic.atoms.textStyle
import com.kevinschildhorn.atomik.color.base.composeColor
import com.kevinschildhorn.fotopresenter.Playlist
import com.kevinschildhorn.fotopresenter.ui.atoms.FotoColors
import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikText
import com.kevinschildhorn.fotopresenter.ui.screens.playlist.PlaylistScreenAtoms

@Composable
Expand All @@ -40,9 +41,9 @@ fun PlaylistColumn(
.background(FotoColors.secondary.composeColor)
) {
Column(Modifier.fillMaxWidth().padding(Padding.MEDIUM.dp)) {
Text(
AtomikText(
"Playlists",
style = atom.textStyle
atom = atom
)
LazyColumn {
items(options) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import androidx.compose.ui.unit.dp
import com.kevinschildhorn.atomik.atomic.atoms.textStyle
import com.kevinschildhorn.atomik.color.base.composeColor
import com.kevinschildhorn.fotopresenter.ui.atoms.Padding
import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikIcon
import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikText
import com.kevinschildhorn.fotopresenter.ui.screens.playlist.PlaylistScreenAtoms
import compose.icons.EvaIcons
import compose.icons.evaicons.Outline
Expand All @@ -34,17 +36,13 @@ fun PlaylistScreenCreateRow(
modifier = Modifier.fillMaxWidth(),
onClick = onClick
) {
Icon(
AtomikIcon(
EvaIcons.Outline.PlusCircle,
tint = atom.textColor.composeColor,
atom,
contentDescription = "Create",
)
Spacer(Modifier.width(Padding.SMALL.dp))
Text(
text = "Create",
color = atom.textColor.composeColor,
style = atom.textStyle,
)
AtomikText("Create", atom)
Spacer(Modifier.fillMaxWidth())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.kevinschildhorn.atomik.atomic.atoms.textStyle
import com.kevinschildhorn.atomik.color.base.composeColor
import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikIcon
import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikText
import com.kevinschildhorn.fotopresenter.ui.screens.playlist.PlaylistScreenAtoms
import compose.icons.EvaIcons
import compose.icons.evaicons.Outline
Expand All @@ -40,31 +42,27 @@ fun PlaylistScreenPlaylistRow(
onClick = onClick,
modifier = Modifier.fillMaxSize(0.7f)
) {
Text(
text = title,
color = atom.textColor.composeColor,
style = atom.textStyle,
)
AtomikText(title, atom)
Spacer(Modifier.fillMaxWidth())
}
Row(modifier = Modifier.fillMaxHeight()) {
TextButton(
modifier = Modifier.width(44.dp),
onClick = onEdit
) {
Icon(
AtomikIcon(
EvaIcons.Outline.Edit,
tint = atom.textColor.composeColor,
atom,
contentDescription = "Edit",
)
}
TextButton(
modifier = Modifier.width(44.dp),
onClick = onDelete,
) {
Icon(
AtomikIcon(
EvaIcons.Outline.Trash,
tint = atom.textColor.composeColor,
atom,
contentDescription = "Trash"
)
}
Expand Down
Loading