-
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 remote-tracking branch 'origin/develop' into add/#28-shadow-mod…
…ifier
- Loading branch information
Showing
39 changed files
with
883 additions
and
113 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
28 changes: 28 additions & 0 deletions
28
.../main/java/com/terning/core/designsystem/component/bottomsheet/TerningBasicBottomSheet.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,28 @@ | ||
package com.terning.core.designsystem.component.bottomsheet | ||
|
||
import androidx.compose.foundation.layout.navigationBarsPadding | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.ModalBottomSheet | ||
import androidx.compose.material3.rememberModalBottomSheetState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun TerningBasicBottomSheet( | ||
modifier: Modifier = Modifier, | ||
content: @Composable () -> Unit, | ||
onDismissRequest: () -> Unit | ||
) { | ||
val sheetState = rememberModalBottomSheetState() | ||
|
||
ModalBottomSheet( | ||
onDismissRequest = { | ||
onDismissRequest() | ||
}, | ||
sheetState = sheetState, | ||
modifier = modifier.navigationBarsPadding() | ||
) { | ||
content() | ||
} | ||
} |
103 changes: 103 additions & 0 deletions
103
core/src/main/java/com/terning/core/designsystem/component/box/ScrapBox.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,103 @@ | ||
package com.terning.core.designsystem.component.box | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.border | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.shadow | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.Dp | ||
import androidx.compose.ui.unit.dp | ||
import com.terning.core.designsystem.theme.CalPink | ||
import com.terning.core.designsystem.theme.CalPurple | ||
import com.terning.core.designsystem.theme.Grey150 | ||
import com.terning.core.designsystem.theme.White | ||
|
||
/** | ||
* ScrapBox is made for easy customization of scrap box used in Calendar & Home Screen | ||
* | ||
* [modifier] must be assigned for assigning size of the box and padding | ||
* [elevation] must be set greater than zero for shadow effect, mainly used in Calendar | ||
* [borderWidth] must be set greater than zero for border effect, mainly used in Home | ||
*/ | ||
|
||
@Composable | ||
fun ScrapBox( | ||
cornerRadius: Dp, | ||
scrapColor: Color, | ||
modifier: Modifier = Modifier, | ||
elevation: Dp = 0.dp, | ||
borderWidth: Dp = 0.dp, | ||
borderColor: Color = Grey150, | ||
content: @Composable () -> Unit, | ||
) { | ||
Box( | ||
modifier = modifier | ||
.border( | ||
width = borderWidth, | ||
color = borderColor, | ||
RoundedCornerShape(cornerRadius), | ||
) | ||
.shadow( | ||
elevation = elevation, | ||
RoundedCornerShape(cornerRadius), | ||
) | ||
) { | ||
Box( | ||
modifier = Modifier | ||
.background( | ||
color = scrapColor, | ||
shape = RoundedCornerShape(cornerRadius) | ||
) | ||
.fillMaxSize() | ||
) | ||
Box( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.padding(start = 9.dp) | ||
.background( | ||
shape = RoundedCornerShape( | ||
topEnd = cornerRadius, bottomEnd = cornerRadius | ||
), color = White | ||
) | ||
) { | ||
content() | ||
} | ||
} | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
fun BorderedScrapBoxPreview() { | ||
ScrapBox( | ||
modifier = Modifier | ||
.height(116.dp) | ||
.width(140.dp), | ||
scrapColor = CalPink, | ||
cornerRadius = 5.dp, | ||
borderWidth = 1.dp | ||
) {} | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
fun ShadowedScrapBoxPreview() { | ||
ScrapBox( | ||
modifier = Modifier | ||
.height(height = 92.dp) | ||
.fillMaxWidth(), | ||
scrapColor = CalPurple, | ||
cornerRadius = 10.dp, | ||
elevation = 1.dp | ||
) {} | ||
} |
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
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
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
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
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.