Skip to content

Commit 5a309fb

Browse files
committed
Implemented themr buttons for challenge tags
1 parent 8f5c284 commit 5a309fb

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
@@ -9,8 +9,8 @@
99
import React from 'react';
1010
import PT from 'prop-types';
1111
import { Link } from 'utils/router';
12-
13-
import './style.scss';
12+
import style from './style.scss';
13+
import { TagButton } from 'components/buttons';
1414

1515
export default function ChallengeTags(props) {
1616
const {
@@ -23,34 +23,34 @@ export default function ChallengeTags(props) {
2323
} = props;
2424

2525
return (
26-
<div styleName="tag-holder">
26+
<div>
2727
{
2828
subTrack &&
29-
<Link
30-
onClick={() => setChallengeListingFilter({ subtracks: [subTrack] })}
29+
<TagButton
3130
to="/challenges"
32-
styleName={`tag-common ${subTrackStyle}`}
33-
>{subTrack}</Link>
31+
onClick={() => setChallengeListingFilter({ subtracks: [subTrack] })}
32+
theme={{ button: style[subTrackStyle] }}
33+
>{subTrack}</TagButton>
3434
}
3535
{
3636
events.map(event => (
37-
<a
38-
href={`https://${event}.topcoder.com`}
37+
<TagButton
38+
to={`https://${event}.topcoder.com`}
39+
theme={{ button: style[eventStyle] }}
3940
key={event}
40-
styleName={`tag-common ${eventStyle}`}
41-
>{event}</a>
41+
>{event}</TagButton>
4242
))
4343
}
4444
{
4545
technPlatforms.map(
4646
tag =>
4747
(
48-
<Link
49-
key={tag}
50-
onClick={() => setChallengeListingFilter({ tags: [tag] })}
48+
<TagButton
5149
to="/challenges"
52-
styleName="tag-common misc-tag"
53-
>{tag}</Link>
50+
onClick={() => setChallengeListingFilter({ tags: [tag] })}
51+
theme={{ button: style.miscTag }}
52+
key={tag}
53+
>{tag}</TagButton>
5454
),
5555
)
5656
}

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)