-
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.
- Loading branch information
Showing
37 changed files
with
944 additions
and
176 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
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
84 changes: 84 additions & 0 deletions
84
core/src/main/java/com/terning/core/designsystem/component/button/ChangeFilterButton.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,84 @@ | ||
package com.terning.core.designsystem.component.button | ||
|
||
import androidx.annotation.StringRes | ||
import androidx.compose.foundation.BorderStroke | ||
import androidx.compose.foundation.interaction.MutableInteractionSource | ||
import androidx.compose.foundation.interaction.collectIsPressedAsState | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.wrapContentHeight | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material.ripple.LocalRippleTheme | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.ButtonDefaults | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.Dp | ||
import androidx.compose.ui.unit.dp | ||
import com.terning.core.designsystem.theme.Grey400 | ||
import com.terning.core.designsystem.theme.TerningMain | ||
import com.terning.core.designsystem.theme.TerningSub1 | ||
import com.terning.core.designsystem.theme.TerningSub5 | ||
import com.terning.core.designsystem.theme.TerningTheme | ||
import com.terning.core.designsystem.theme.White | ||
import com.terning.core.util.NoRippleTheme | ||
|
||
@Composable | ||
fun ChangeFilterButton( | ||
isSelected: Boolean, | ||
@StringRes text: Int, | ||
cornerRadius: Dp, | ||
paddingVertical: Dp, | ||
onButtonClick: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
val interactionSource = remember { MutableInteractionSource() } | ||
val isPressed by interactionSource.collectIsPressedAsState() | ||
val backgroundColor = when { | ||
!isSelected && !isPressed -> White | ||
!isSelected && isPressed -> TerningSub5 | ||
else -> TerningMain | ||
} | ||
val textColor = when { | ||
!isSelected -> Grey400 | ||
else -> White | ||
} | ||
val borderColor = when { | ||
!isSelected && !isPressed -> TerningMain | ||
!isSelected && isPressed -> TerningSub1 | ||
else -> TerningMain | ||
} | ||
|
||
CompositionLocalProvider(LocalRippleTheme provides NoRippleTheme) { | ||
Button( | ||
contentPadding = PaddingValues(vertical = paddingVertical), | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.wrapContentHeight(), | ||
interactionSource = interactionSource, | ||
colors = ButtonDefaults.buttonColors( | ||
containerColor = backgroundColor, | ||
contentColor = textColor, | ||
), | ||
border = BorderStroke( | ||
width = 1.dp, | ||
color = borderColor | ||
), | ||
shape = RoundedCornerShape(cornerRadius), | ||
onClick = { onButtonClick() } | ||
) { | ||
Text( | ||
text = stringResource(id = text), | ||
style = TerningTheme.typography.button3, | ||
textAlign = TextAlign.Center, | ||
) | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
core/src/main/java/com/terning/core/designsystem/component/item/InternItemWithShadow.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,41 @@ | ||
package com.terning.core.designsystem.component.item | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import com.terning.core.designsystem.theme.Grey200 | ||
import com.terning.core.designsystem.theme.White | ||
import com.terning.core.extension.customShadow | ||
|
||
@Composable | ||
fun InternItemWithShadow( | ||
imageUrl: String, | ||
title: String, | ||
dateDeadline: String, | ||
workingPeriod: String, | ||
isScraped: Boolean, | ||
) { | ||
Box( | ||
modifier = Modifier | ||
.customShadow( | ||
color = Grey200, | ||
shadowRadius = 10.dp, | ||
shadowWidth = 2.dp, | ||
) | ||
.background( | ||
color = White, | ||
shape = RoundedCornerShape(10.dp) | ||
) | ||
) { | ||
InternItem( | ||
imageUrl = imageUrl, | ||
title = title, | ||
dateDeadline = dateDeadline, | ||
workingPeriod = workingPeriod, | ||
isScraped = isScraped | ||
) | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
data/src/main/java/com/terning/data/datasource/SearchDataSource.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,8 @@ | ||
package com.terning.data.datasource | ||
|
||
import com.terning.data.dto.BaseResponse | ||
import com.terning.data.dto.response.SearchViewsResponseDto | ||
|
||
interface SearchDataSource { | ||
suspend fun getSearchViews(): BaseResponse<SearchViewsResponseDto> | ||
} |
14 changes: 14 additions & 0 deletions
14
data/src/main/java/com/terning/data/datasourceimpl/SearchDataSourceImpl.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,14 @@ | ||
package com.terning.data.datasourceimpl | ||
|
||
import com.terning.data.datasource.SearchDataSource | ||
import com.terning.data.dto.BaseResponse | ||
import com.terning.data.dto.response.SearchViewsResponseDto | ||
import com.terning.data.service.SearchService | ||
import javax.inject.Inject | ||
|
||
class SearchDataSourceImpl @Inject constructor( | ||
private val searchService: SearchService, | ||
) : SearchDataSource { | ||
override suspend fun getSearchViews(): BaseResponse<SearchViewsResponseDto> = | ||
searchService.getSearchViewsList() | ||
} |
27 changes: 27 additions & 0 deletions
27
data/src/main/java/com/terning/data/dto/response/SearchViewsResponseDto.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,27 @@ | ||
package com.terning.data.dto.response | ||
|
||
import com.terning.domain.entity.response.InternshipAnnouncement | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SearchViewsResponseDto( | ||
@SerialName("internshipAnnouncementId") | ||
val internshipAnnouncementId: Long, | ||
@SerialName("companyImage") | ||
val companyImage: String, | ||
@SerialName("title") | ||
val title: String, | ||
) { | ||
|
||
|
||
fun toSearchViewsEntity(): List<InternshipAnnouncement> { | ||
return listOf( | ||
InternshipAnnouncement( | ||
announcementId = internshipAnnouncementId, | ||
companyImage = companyImage, | ||
title = title, | ||
) | ||
) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
data/src/main/java/com/terning/data/repositoryimpl/SearchViewsRepositoryImpl.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,15 @@ | ||
package com.terning.data.repositoryimpl | ||
|
||
import com.terning.data.datasource.SearchDataSource | ||
import com.terning.domain.entity.response.InternshipAnnouncement | ||
import com.terning.domain.repository.SearchRepository | ||
import javax.inject.Inject | ||
|
||
class SearchViewsRepositoryImpl @Inject constructor( | ||
private val searchDataSource: SearchDataSource, | ||
) : SearchRepository { | ||
override suspend fun getSearchViewsList(): Result<List<InternshipAnnouncement>> = | ||
runCatching { | ||
searchDataSource.getSearchViews().result.toSearchViewsEntity() | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
data/src/main/java/com/terning/data/service/SearchService.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,10 @@ | ||
package com.terning.data.service | ||
|
||
import com.terning.data.dto.BaseResponse | ||
import com.terning.data.dto.response.SearchViewsResponseDto | ||
import retrofit2.http.GET | ||
|
||
interface SearchService { | ||
@GET("api/v1/search/views") | ||
suspend fun getSearchViewsList(): BaseResponse<SearchViewsResponseDto> | ||
} |
7 changes: 7 additions & 0 deletions
7
domain/src/main/java/com/terning/domain/entity/response/InternshipAnnouncement.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,7 @@ | ||
package com.terning.domain.entity.response | ||
|
||
data class InternshipAnnouncement( | ||
val title: String, | ||
val companyImage: String, | ||
val announcementId: Long, | ||
) |
7 changes: 7 additions & 0 deletions
7
domain/src/main/java/com/terning/domain/repository/SearchRepository.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,7 @@ | ||
package com.terning.domain.repository | ||
|
||
import com.terning.domain.entity.response.InternshipAnnouncement | ||
|
||
interface SearchRepository { | ||
suspend fun getSearchViewsList(): Result<List<InternshipAnnouncement>> | ||
} |
Oops, something went wrong.