Skip to content

Commit

Permalink
Enhancement: UI refactor for Card
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0is1 committed Oct 16, 2024
1 parent 800eee7 commit 0daeb8c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/constants/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ export const colors = {
floatingPlayerBgPrimary: "#000000",
floatingPlayerColorSecomdary: "#B0B0B0",
categoryColorPrimary: "#46494d",
cardBgPrimary: "rgba(20, 34, 51, 0.73)"
}
28 changes: 21 additions & 7 deletions src/screens/AlbumsScreen/components/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@ import { fonts } from "../../../constants/fonts";

const Card = ({ albumData, index }) => {
const navigation = useNavigation();
const { title, name, image } = albumData;
const { title, name, image, type } = albumData;

const albumTitle = title || name;
const displayTitle = decode(
albumTitle.length > 25 ? `${albumTitle.substring(0, 25)}...` : albumTitle
albumTitle.length > 30 ? `${albumTitle.substring(0, 30)}...` : albumTitle
);

const optimizedImageUri = image
.replace("150x150", "500x500")
.replace("50x50", "500x500");

const handlePress = () =>
handleAlbum({
albumData,
Expand All @@ -48,6 +47,7 @@ const Card = ({ albumData, index }) => {
imageStyle={styles.imageOverlay}
>
<View style={styles.overlay} />
<Text style={styles.albumType}>{type}</Text>
<Text style={styles.title}>{displayTitle}</Text>
</ImageBackground>
</TouchableOpacity>
Expand All @@ -59,7 +59,7 @@ export default Card;
const styles = StyleSheet.create({
card: {
backgroundColor: colors.secondaryColor,
borderRadius: 10,
borderRadius: 8,
shadowColor: colors.primaryColor,
shadowOpacity: 0.15,
shadowRadius: 6,
Expand All @@ -84,10 +84,24 @@ const styles = StyleSheet.create({
},
title: {
position: "absolute",
bottom: 8,
left: 8,
fontSize: 16,
textAlign: "center",
fontSize: 14,
color: colors.secondaryColor,
fontFamily: fonts.poppinsSecondary,
backgroundColor: colors.cardBgPrimary,
width: "100%"
},
albumType: {
position: "absolute",
top: 0,
right: 0,
margin: 5,
paddingHorizontal: 5,
borderRadius: 3,
backgroundColor: colors.cardBgPrimary,
textTransform: "capitalize",
color: colors.secondaryColor,
fontFamily: fonts.poppinsPrimary,
fontSize: 12
}
});

0 comments on commit 0daeb8c

Please sign in to comment.