Replace the download button with a bookmark

This commit is contained in:
Nat 2021-02-28 11:21:35 -04:00
parent 934c711d7d
commit 6cfac2be98
3 changed files with 20 additions and 13 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@ -27,10 +27,8 @@ function reblogCallback(state, updater) {
invertField("reblogged", state, updater); invertField("reblogged", state, updater);
} }
function downloadCallback(state, updater) { function bookmarkCallback(state, updater) {
let newState = state; invertField("bookmarked", state, updater);
newState.downloaded = true;
updater(newState);
} }
const PostActionJsx = (props) => { const PostActionJsx = (props) => {
@ -41,7 +39,12 @@ const PostActionJsx = (props) => {
source = { source = {
activeOrNot(props.state[props.field], props.pack) activeOrNot(props.state[props.field], props.pack)
} }
style = { styles.icon } /> style = {
[
styles.icon,
props.last ? styles.lastIcon : {}
]
} />
</TouchableWithoutFeedback> </TouchableWithoutFeedback>
) )
} }
@ -51,7 +54,7 @@ const PostActionBarJsx = (props) => {
favourited: props.favourited, favourited: props.favourited,
commenting: false, commenting: false,
reblogged: props.reblogged, reblogged: props.reblogged,
downloaded: false bookmarked: false
}); });
const icons = { const icons = {
@ -67,9 +70,9 @@ const PostActionBarJsx = (props) => {
active: require("assets/eva-icons/post-actions/reblog-active.png"), active: require("assets/eva-icons/post-actions/reblog-active.png"),
inactive: require("assets/eva-icons/post-actions/reblog-inactive.png") inactive: require("assets/eva-icons/post-actions/reblog-inactive.png")
}, },
download: { bookmark: {
active: require("assets/eva-icons/post-actions/download-active.png"), active: require("assets/eva-icons/post-actions/bookmark-active.png"),
inactive: require("assets/eva-icons/post-actions/download-inactive.png") inactive: require("assets/eva-icons/post-actions/bookmark-inactive.png")
} }
} }
return ( return (
@ -93,10 +96,11 @@ const PostActionBarJsx = (props) => {
callback = { () => reblogCallback(state, setState) } /> callback = { () => reblogCallback(state, setState) } />
<PostActionJsx <PostActionJsx
field = "downloaded" field = "bookmarked"
pack = { icons.download } pack = { icons.bookmark }
last = { true }
state = { state } state = { state }
callback = { () => downloadCallback(state, setState) } /> callback = { () => bookmarkCallback(state, setState) } />
</View> </View>
) )
} }
@ -111,7 +115,10 @@ const styles = {
width: 30, width: 30,
height: 30, height: 30,
marginRight: Dimensions.get("window").width / 20 marginRight: Dimensions.get("window").width / 20
},
lastIcon: {
marginLeft: "auto"
} }
} }
export default PostActionBarJsx; export default PostActionBarJsx;