Skip to content

Commit

Permalink
Merge pull request #39 from KevinSchildhorn/CreatingAtomikComposables
Browse files Browse the repository at this point in the history
Adding Atomik Composables
  • Loading branch information
KevinSchildhorn authored Dec 16, 2023
2 parents b1d4ee5 + 5e832c2 commit f94b905
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 32 deletions.
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

0 comments on commit f94b905

Please sign in to comment.