Skip to content

Commit fc5556f

Browse files
committed
Implemented themr buttons for challenge tags
1 parent 47d253b commit fc5556f

File tree

4 files changed

+71
-44
lines changed

4 files changed

+71
-44
lines changed

src/shared/components/buttons/index.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import dangerButton from './danger.scss';
4747
import defaultButton from './default.scss';
4848
import primaryDesignButton from './primaryDesign.scss';
4949
import secondaryButton from './secondary.scss';
50+
import tagButton from './tags.scss';
5051

5152
/* Generic button, not wrapped by themr, but accepting theme property.
5253
* In most cases you will want to use some of the themable exports below
@@ -123,4 +124,7 @@ export const PrimaryButton =
123124
export const SecondaryButton =
124125
themr('SecondaryButton', secondaryButton)(GenericButton);
125126

126-
export default undefined;
127+
export const TagButton =
128+
themr('TagButton', tagButton)(GenericButton);
129+
130+
export default undefined;
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* Challenge tag button, default style with white text on light blue background.
3+
*/
4+
@import "~styles/tc-styles";
5+
6+
@mixin feedback {
7+
&:active,
8+
&:focus,
9+
&:hover {
10+
color: $tc-white;
11+
}
12+
}
13+
14+
.button {
15+
border-radius: 3px;
16+
font-family: roboto;
17+
font-size: 10px;
18+
line-height: 20px;
19+
margin: 5px 5px 0 0;
20+
display: inline-block;
21+
text-align: center;
22+
padding: 0 5px;
23+
font-weight: 700;
24+
color: $tc-white;
25+
background-color: $tc-light-blue-10;
26+
&,
27+
&:visited {
28+
color: $tc-white;
29+
}
30+
}
31+
32+
.disabled {
33+
background-color: $tc-gray-20;
34+
}
35+
36+
.link,
37+
.regular {
38+
@include feedback;
39+
}

src/shared/components/challenge-detail/Header/ChallengeTags.jsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import React from 'react';
1010
import PT from 'prop-types';
1111
import _ from 'lodash';
1212
import { Link } from 'utils/router';
13-
14-
import './style.scss';
13+
import style from './style.scss';
14+
import { TagButton } from 'components/buttons';
1515

1616
export default function ChallengeTags(props) {
1717
const {
@@ -33,34 +33,34 @@ export default function ChallengeTags(props) {
3333
};
3434

3535
return (
36-
<div styleName="tag-holder">
36+
<div>
3737
{
3838
subTrack &&
39-
<Link
40-
onClick={() => setChallengeListingFilter({ subtracks: [subTrack] })}
39+
<TagButton
4140
to="/challenges"
42-
styleName={`tag-common ${subTrackStyle}`}
43-
>{stylizedSubTrack(subTrack)}</Link>
41+
onClick={() => setChallengeListingFilter({ subtracks: [subTrack] })}
42+
theme={{ button: style[subTrackStyle] }}
43+
>{stylizedSubTrack(subTrack)}</TagButton>
4444
}
4545
{
4646
events.map(event => (
47-
<a
48-
href={`https://${event}.topcoder.com`}
47+
<TagButton
48+
to={`https://${event}.topcoder.com`}
49+
theme={{ button: style[eventStyle] }}
4950
key={event}
50-
styleName={`tag-common ${eventStyle}`}
51-
>{event}</a>
51+
>{event}</TagButton>
5252
))
5353
}
5454
{
5555
technPlatforms.map(
5656
tag =>
5757
(
58-
<Link
59-
key={tag}
60-
onClick={() => setChallengeListingFilter({ tags: [tag] })}
58+
<TagButton
6159
to="/challenges"
62-
styleName="tag-common misc-tag"
63-
>{tag}</Link>
60+
onClick={() => setChallengeListingFilter({ tags: [tag] })}
61+
theme={{ button: style.miscTag }}
62+
key={tag}
63+
>{tag}</TagButton>
6464
),
6565
)
6666
}

src/shared/components/challenge-detail/Header/style.scss

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -124,33 +124,17 @@
124124
}
125125
}
126126

127-
.tag-holder {
128-
.tag-common {
129-
border-radius: 3px;
130-
font-family: roboto;
131-
font-size: 10px;
132-
line-height: 20px;
133-
margin: 5px 5px 0 0;
134-
display: inline-block;
135-
text-align: center;
136-
padding: 0 5px;
137-
font-weight: 700;
138-
color: $tc-white;
139-
background-color: $tc-light-blue-10;
140-
}
141-
142-
@include design-accent-bg;
143-
@include develop-accent-bg;
144-
@include datasci-accent-bg;
145-
@include design-accent-clr;
146-
@include develop-accent-clr;
147-
@include datasci-accent-clr;
148-
149-
.misc-tag {
150-
color: $tc-gray-80;
151-
background-color: $tc-gray-neutral-dark;
152-
cursor: pointer;
153-
}
127+
@include design-accent-bg;
128+
@include develop-accent-bg;
129+
@include datasci-accent-bg;
130+
@include design-accent-clr;
131+
@include develop-accent-clr;
132+
@include datasci-accent-clr;
133+
134+
.miscTag {
135+
color: $tc-gray-80;
136+
background-color: $tc-gray-neutral-dark;
137+
cursor: pointer;
154138
}
155139

156140
.prizes-ops-container {

0 commit comments

Comments
 (0)