MCPcopy
hub / github.com/Justineo/github-hovercard / toggleButtonState

Function toggleButtonState

src/hovercard.js:2006–2041  ·  view source on GitHub ↗
(action)

Source from the content-addressed store, hash-verified

2004 })
2005
2006 function toggleButtonState(action) {
2007 return {
2008 follow: {
2009 type: 'user',
2010 field: 'followed_by_me',
2011 value: true,
2012 className: 'ghh-aux',
2013 action: 'unfollow',
2014 content: `Unfollow`
2015 },
2016 unfollow: {
2017 type: 'user',
2018 field: 'followed_by_me',
2019 value: false,
2020 className: 'ghh-primary',
2021 action: 'follow',
2022 content: `Follow`
2023 },
2024 star: {
2025 type: 'repo',
2026 field: 'starred_by_me',
2027 value: true,
2028 className: 'ghh-aux',
2029 action: 'unstar',
2030 content: `${getIcon('star-fill', 0.75)} Unstar`
2031 },
2032 unstar: {
2033 type: 'repo',
2034 field: 'starred_by_me',
2035 value: false,
2036 className: 'ghh-primary',
2037 action: 'star',
2038 content: `${getIcon('star', 0.75)} Star`
2039 }
2040 }[action]
2041 }
2042
2043 if (me) {
2044 $('body').on('click', '[data-action]', function() {

Callers 1

hovercard.jsFile · 0.70

Calls 1

getIconFunction · 0.70

Tested by

no test coverage detected