Skip to content

Commit

Permalink
Create Spacer components
Browse files Browse the repository at this point in the history
  • Loading branch information
yasanglass committed Oct 18, 2023
1 parent 0df194b commit 7bc5165
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package glass.yasan.stillbirth.component

import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.width
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp

@Composable
public fun Spacer(
width: Dp,
height: Dp,
) {
Spacer(
modifier = Modifier
.width(width)
.height(height),
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package glass.yasan.stillbirth.component

import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

@Composable
public fun SpacerHorizontal(
width: Dp,
) {
Spacer(
width = width,
height = 0.dp,
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package glass.yasan.stillbirth.component

import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

@Composable
public fun SpacerVertical(
height: Dp,
) {
Spacer(
width = 0.dp,
height = height,
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package glass.yasan.stillbirth.component.extension

import androidx.compose.foundation.lazy.LazyListScope
import glass.yasan.stillbirth.component.Divider

public fun LazyListScope.divider() {
item {
Divider()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package glass.yasan.stillbirth.component.extension

import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.ui.unit.Dp
import glass.yasan.stillbirth.component.Spacer
import glass.yasan.stillbirth.component.SpacerHorizontal
import glass.yasan.stillbirth.component.SpacerVertical

public fun LazyListScope.spacer(
width: Dp,
height: Dp,
) {
item {
Spacer(
width = width,
height = height,
)
}
}

public fun LazyListScope.spacerHorizontal(
width: Dp,
) {
item {
SpacerHorizontal(
width = width,
)
}
}

public fun LazyListScope.spacerVertical(
height: Dp,
) {
item {
SpacerVertical(
height = height,
)
}
}

0 comments on commit 7bc5165

Please sign in to comment.