-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Aghs Tooltip on Hero Page #2753
Open
skitttt
wants to merge
9
commits into
odota:master
Choose a base branch
from
skitttt:aghs_descriptions_hero_page
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+298
−3
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9882269
add Aghs icon to hero page
skitttt aa31c52
aghs backend stuff
skitttt 4acf678
some update idk. skeleton of aghs tooltip in place
skitttt 2dea027
update aghs tooltip
skitttt 10973ac
get data to tooltip
skitttt 4a7afcc
split out tooltips, but broken :(
skitttt c6b6d79
fix tooltips showing up
skitttt 1fbb020
make ability upgrade text. need to flex whitespace of text for longer…
skitttt 55034c4
fix ability upgrade background color bleed
skitttt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
import React from 'react'; | ||
import propTypes, { string } from 'prop-types'; | ||
import styled from 'styled-components'; | ||
import constants from '../constants'; | ||
import AbilityTooltip from '../AbilityTooltip'; | ||
|
||
const Wrapper = styled.div` | ||
position: relative; | ||
width: 300px; | ||
background: #131519; | ||
background: linear-gradient(135deg, #131519, #1f2228); | ||
overflow: hidden; | ||
border: 2px solid #27292b; | ||
|
||
& > div:nth-child(2) { | ||
position: relative; | ||
border-top: 1px solid #080D15; | ||
} | ||
`; | ||
|
||
const InnerWrapper = styled.div` | ||
overflow: hidden; | ||
`; | ||
|
||
const Header = styled.div` | ||
background: linear-gradient(to right, #51565F , #303338); | ||
position: relative; | ||
`; | ||
|
||
const HeaderContent = styled.div` | ||
position: relative; | ||
display: flex; | ||
height: 50px; | ||
padding: 13px; | ||
white-space: nowrap; | ||
|
||
& img { | ||
display: inline-block; | ||
height: 100%; | ||
border: 1px solid #080D15; | ||
} | ||
|
||
& .name { | ||
font-size: ${constants.fontSizeCommon}; | ||
text-transform: uppercase; | ||
color: ${constants.primaryTextColor}; | ||
font-weight: bold; | ||
text-shadow: 1px 1px black; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
text-overflow: ellipsis; | ||
letter-spacing: 1px; | ||
} | ||
`; | ||
|
||
const UpgradeTypeWrapper = styled.div` | ||
|
||
display: flex; | ||
flex-direction: row; | ||
padding: 2px 0px; | ||
margin: 2px 0px; | ||
border-radius: 4px; | ||
|
||
& .upgrade_type_text { | ||
background-color: #1c2e50; | ||
color: #DDDDDD; | ||
font-size: ${constants.fontSizeTiny}; | ||
display: inline-flex; | ||
text-transform: uppercase; | ||
letter-spacing: 1px; | ||
padding: 2px 4px; | ||
} | ||
|
||
& .upgrade_type_filler { | ||
display: inline-flex; | ||
} | ||
|
||
`; | ||
|
||
const HeaderText = styled.div` | ||
padding-left: 10px; | ||
display: flex; | ||
flex-direction: column; | ||
|
||
`; | ||
|
||
|
||
const HeaderBgImg = styled.div` | ||
position: absolute; | ||
left: -20px; | ||
height: 100%; | ||
width: 20%; | ||
background: ${({ img }) => `linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('${process.env.REACT_APP_IMAGE_CDN}${img}')`}; | ||
background-color: transparent; | ||
background-repeat: no-repeat; | ||
transform: scale(4); | ||
filter: blur(15px); | ||
`; | ||
|
||
const Description = styled.div` | ||
position: relative; | ||
padding: 13px; | ||
color: #95a5a6; | ||
text-shadow: 1px 1px black; | ||
`; | ||
|
||
|
||
const Break = styled.div` | ||
margin-left: 13px; | ||
margin-right: 13px; | ||
height: 1px; | ||
background-color: #080D15; | ||
`; | ||
|
||
|
||
const AghsTooltip = (props) => { | ||
|
||
const aghs = props.aghs; | ||
|
||
const renderToolTip = (aghs) => { | ||
if(aghs.new_skill === true) { | ||
// display ability type TT | ||
return ( | ||
<AbilityTooltip ability={aghs.skillObj} /> | ||
) | ||
} | ||
else{ | ||
return ( | ||
// display minimal description | ||
<InnerWrapper> | ||
<Header> | ||
<HeaderBgImg img={aghs.skillObj.img} /> | ||
<HeaderContent> | ||
<img id="ability-img" src={`${process.env.REACT_APP_IMAGE_CDN}${aghs.skillObj.img}`} alt="" /> | ||
<HeaderText> | ||
<div className="name">{aghs.skill_name_loc}</div> | ||
<UpgradeTypeWrapper> | ||
<div className="upgrade_type_text">Ability Upgrade</div> | ||
<div className="upgrade_type_filler"/> | ||
</UpgradeTypeWrapper> | ||
</HeaderText> | ||
</HeaderContent> | ||
</Header> | ||
<Description> | ||
{aghs.desc} | ||
</Description> | ||
</InnerWrapper> | ||
) | ||
} | ||
} | ||
|
||
return ( | ||
<Wrapper> | ||
{renderToolTip(aghs)} | ||
</Wrapper> | ||
); | ||
} | ||
|
||
AghsTooltip.propTypes = { | ||
aghs: propTypes.shape({}).isRequired, | ||
}; | ||
|
||
export default AghsTooltip; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import styled from 'styled-components'; | ||
import nanoid from 'nanoid'; | ||
import propTypes from 'prop-types'; | ||
import ReactTooltip from 'react-tooltip'; | ||
|
||
import constants from '../constants'; | ||
import AghsTooltip from '../AghsTooltip'; | ||
|
||
const Wrapper = styled.div` | ||
background: linear-gradient(to bottom, ${constants.colorBlueMuted}, ${constants.primarySurfaceColor}); | ||
border-radius: 4px; | ||
box-shadow: 0 2px 2px rgba(0, 0, 0, .3); | ||
position: relative; | ||
|
||
.__react_component_tooltip { | ||
opacity: 1 !important; | ||
padding: 0px !important; | ||
`; | ||
|
||
const AghsSlot = styled.div` | ||
border-radius: 4px; | ||
display: flex; | ||
flex-direction: column; | ||
height: auto; | ||
opacity: 1; | ||
overflow: hidden; | ||
transition: opacity .2s, box-shadow .4s, transform .2s; | ||
width: 100%; | ||
|
||
.solid_line { | ||
border-top: 1px solid #1e1e1f; | ||
margin: 2px 5px 2px 5px; | ||
} | ||
`; | ||
|
||
const IconWrapper = styled.div` | ||
display: block; | ||
overflow: hidden; | ||
margin-right: auto; | ||
margin-left: auto; | ||
|
||
&:hover { | ||
opacity: 1; | ||
box-shadow: 0 0 150px rgba(255, 255, 255, .4); | ||
transform: scale(1.1); | ||
} | ||
`; | ||
|
||
const AghsIcon = styled.img` | ||
display: block; | ||
overflow: hidden; | ||
margin-right: auto; | ||
margin-left: auto; | ||
width: 66%; | ||
height: 66%; | ||
`; | ||
|
||
const ShardIcon = styled.img` | ||
display: block; | ||
overflow: hidden; | ||
margin-right: auto; | ||
margin-left: auto; | ||
width: 66%; | ||
height: 66%; | ||
`; | ||
|
||
|
||
const Aghs = ({heroAghs, hero_npc_name, skills}) => { | ||
const ttId = nanoid(); | ||
const ttId2 = nanoid(); | ||
|
||
const hero_name = hero_npc_name; | ||
const agh_element = heroAghs[hero_name]; | ||
|
||
agh_element.scepter.skillObj = skills.find(skill => { | ||
return skill.data.dname === agh_element.scepter.skill_name_loc; | ||
}).data; | ||
agh_element.shard.skillObj = skills.find(skill => { | ||
return skill.data.dname === agh_element.shard.skill_name_loc; | ||
}).data; | ||
|
||
|
||
|
||
//const scepter_img = skills[0].key + skills[0].data.img; | ||
|
||
|
||
return ( | ||
<Wrapper> | ||
<AghsSlot alt="aghs"> | ||
<IconWrapper data-tip data-for="scepter_tt"> | ||
<AghsIcon src="/assets/images/dota2/scepter_1.png"/> | ||
|
||
</IconWrapper> | ||
<ReactTooltip id="scepter_tt" effect="solid" place="left"> | ||
<AghsTooltip place="right" aghs={agh_element.scepter}/> | ||
</ReactTooltip> | ||
<div class="solid_line"/> | ||
<IconWrapper data-tip data-for="shard_tt"> | ||
<ShardIcon src="/assets/images/dota2/shard_1.png"/> | ||
</IconWrapper> | ||
<ReactTooltip id="shard_tt" effect="solid" place="left"> | ||
<AghsTooltip place="right" aghs={agh_element.shard}/> | ||
</ReactTooltip> | ||
</AghsSlot> | ||
|
||
</Wrapper> | ||
); | ||
}; | ||
|
||
Aghs.propTypes = { | ||
heroAghs: propTypes.shape({}).isRequired, | ||
skills: propTypes.array.isRequired, | ||
hero_npc_name: propTypes.string.isRequired, | ||
}; | ||
|
||
const mapStateToProps = state => ({ | ||
heroAghs: state.app.heroAghs | ||
}); | ||
|
||
export default connect(mapStateToProps)(Aghs); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed subtle problem with rounded corners of mana consumption icons.