mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-04 16:38:55 +08:00
添加歌单分类、排行榜激活指示器
This commit is contained in:
parent
202bcf6f54
commit
4534e2f9e7
@ -5,6 +5,7 @@
|
|||||||
### 优化
|
### 优化
|
||||||
|
|
||||||
- 更新设置界面菜单布局
|
- 更新设置界面菜单布局
|
||||||
|
- 添加歌单分类、排行榜激活指示器
|
||||||
|
|
||||||
### 修复
|
### 修复
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import { useTheme } from '@/store/theme/hook'
|
|||||||
import Button, { type BtnType } from '@/components/common/Button'
|
import Button, { type BtnType } from '@/components/common/Button'
|
||||||
import { createStyle } from '@/utils/tools'
|
import { createStyle } from '@/utils/tools'
|
||||||
import { type BoardItem } from '@/store/leaderboard/state'
|
import { type BoardItem } from '@/store/leaderboard/state'
|
||||||
|
import { Icon } from '@/components/common/Icon'
|
||||||
|
|
||||||
// index={index}
|
// index={index}
|
||||||
// longPressIndex={longPressIndex}
|
// longPressIndex={longPressIndex}
|
||||||
@ -32,6 +33,8 @@ export default ({ item, activeId, index, longPressIndex, onBoundChange, onShowMe
|
|||||||
}
|
}
|
||||||
}, [index, item, onShowMenu])
|
}, [index, item, onShowMenu])
|
||||||
|
|
||||||
|
const active = activeId == item.id
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
ref={buttonRef}
|
ref={buttonRef}
|
||||||
@ -39,16 +42,35 @@ export default ({ item, activeId, index, longPressIndex, onBoundChange, onShowMe
|
|||||||
key={item.id} onLongPress={setPosition}
|
key={item.id} onLongPress={setPosition}
|
||||||
onPress={() => { onBoundChange(item) }}
|
onPress={() => { onBoundChange(item) }}
|
||||||
>
|
>
|
||||||
<Text size={14} color={activeId == item.id ? theme['c-primary-font-active'] : theme['c-font']} numberOfLines={1}>{item.name}</Text>
|
{
|
||||||
|
active
|
||||||
|
? <Icon style={styles.listActiveIcon} name="chevron-right" size={12} color={theme['c-primary-font']} />
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
<Text style={styles.listName} size={14} color={active ? theme['c-primary-font-active'] : theme['c-font']} numberOfLines={1}>{item.name}</Text>
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = createStyle({
|
const styles = createStyle({
|
||||||
button: {
|
button: {
|
||||||
paddingLeft: 10,
|
paddingLeft: 5,
|
||||||
paddingRight: 10,
|
paddingRight: 10,
|
||||||
paddingTop: 10,
|
paddingTop: 10,
|
||||||
paddingBottom: 10,
|
paddingBottom: 10,
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
|
listActiveIcon: {
|
||||||
|
// width: 18,
|
||||||
|
marginLeft: 3,
|
||||||
|
// paddingRight: 5,
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
listName: {
|
||||||
|
height: '100%',
|
||||||
|
justifyContent: 'center',
|
||||||
|
paddingLeft: 6,
|
||||||
|
// backgroundColor: 'rgba(0,0,0,0.1)',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,6 +5,7 @@ import { useI18n } from '@/lang'
|
|||||||
import { useTheme } from '@/store/theme/hook'
|
import { useTheme } from '@/store/theme/hook'
|
||||||
import Text from '@/components/common/Text'
|
import Text from '@/components/common/Text'
|
||||||
import { createStyle } from '@/utils/tools'
|
import { createStyle } from '@/utils/tools'
|
||||||
|
import { BorderWidths } from '@/theme'
|
||||||
|
|
||||||
export interface SortTabProps {
|
export interface SortTabProps {
|
||||||
onSortChange: (id: string) => void
|
onSortChange: (id: string) => void
|
||||||
@ -44,7 +45,7 @@ export default forwardRef<SortTabType, SortTabProps>(({ onSortChange }, ref) =>
|
|||||||
{
|
{
|
||||||
sorts.map(s => (
|
sorts.map(s => (
|
||||||
<TouchableOpacity style={styles.button} onPress={() => { handleSortChange(s.id) }} key={s.id}>
|
<TouchableOpacity style={styles.button} onPress={() => { handleSortChange(s.id) }} key={s.id}>
|
||||||
<Text style={styles.buttonText} color={activeId == s.id ? theme['c-primary-font-active'] : theme['c-font']}>{s.label}</Text>
|
<Text style={{ ...styles.buttonText, borderBottomColor: activeId == s.id ? theme['c-primary-background-active'] : 'transparent' }} color={activeId == s.id ? theme['c-primary-font-active'] : theme['c-font']}>{s.label}</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@ -64,6 +65,8 @@ const styles = createStyle({
|
|||||||
// height: 38,
|
// height: 38,
|
||||||
// lineHeight: 38,
|
// lineHeight: 38,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
|
paddingLeft: 14,
|
||||||
|
paddingRight: 14,
|
||||||
// width: 80,
|
// width: 80,
|
||||||
// backgroundColor: 'rgba(0,0,0,0.1)',
|
// backgroundColor: 'rgba(0,0,0,0.1)',
|
||||||
},
|
},
|
||||||
@ -71,10 +74,8 @@ const styles = createStyle({
|
|||||||
// height: 38,
|
// height: 38,
|
||||||
// lineHeight: 38,
|
// lineHeight: 38,
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
paddingLeft: 15,
|
paddingHorizontal: 2,
|
||||||
paddingRight: 15,
|
paddingVertical: 3,
|
||||||
// paddingTop: 10,
|
borderBottomWidth: BorderWidths.normal3,
|
||||||
// paddingBottom: 10,
|
|
||||||
// width: 80,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user