Move and rename VectorIcon

This commit is contained in:
Benoit Marty 2023-02-14 13:23:38 +01:00 committed by Benoit Marty
parent d253670d78
commit 9234f47ce3
4 changed files with 23 additions and 41 deletions

View file

@ -1,37 +0,0 @@
/*
* Copyright (c) 2022 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.element.android.libraries.designsystem.components
import androidx.compose.material3.LocalContentColor
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
@Composable
fun VectorIcon(
resourceId: Int,
modifier: Modifier = Modifier,
tint: Color = LocalContentColor.current,
) {
androidx.compose.material3.Icon(
painter = painterResource(id = resourceId),
contentDescription = null,
modifier = modifier,
tint = tint
)
}

View file

@ -16,6 +16,7 @@
package io.element.android.libraries.designsystem.theme.components
import androidx.annotation.DrawableRes
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material3.LocalContentColor
@ -24,6 +25,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
@ -58,6 +60,21 @@ fun Icon(
)
}
@Composable
fun Icon(
@DrawableRes resourceId: Int,
contentDescription: String?,
modifier: Modifier = Modifier,
tint: Color = LocalContentColor.current,
) {
androidx.compose.material3.Icon(
painter = painterResource(id = resourceId),
contentDescription = contentDescription,
modifier = modifier,
tint = tint
)
}
@Preview
@Composable
internal fun IconImageVectorLightPreview() =