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