diff --git a/src/components/ButtonLink/ButtonLink.stories.tsx b/src/components/ButtonLink/ButtonLink.stories.tsx deleted file mode 100644 index bcf16f56..00000000 --- a/src/components/ButtonLink/ButtonLink.stories.tsx +++ /dev/null @@ -1,117 +0,0 @@ -import React from 'react'; -import { css } from 'emotion'; - -import { space } from '@guardian/src-foundations'; -import { SvgCheckmark } from '@guardian/src-icons'; - -import { Pillar } from '@guardian/types'; - -import { Row } from '../Row/Row'; - -import { ButtonLink } from './ButtonLink'; - -const Space = ({ amount }: { amount: 1 | 2 | 3 | 4 | 5 | 6 | 9 | 12 | 24 }) => ( -
-); - -export default { component: ButtonLink, title: 'ButtonLink' }; - -export const Single = () => ( - { - alert('Clicked!'); - }} - pillar={Pillar.Lifestyle} - linkName="" - > - I'm a button but I look like a link. Click me - -); -Single.story = { name: 'a single button' }; - -export const Small = () => ( - { - alert('Clicked!'); - }} - size="small" - pillar={Pillar.Lifestyle} - linkName="" - > - I'm small - -); -Small.story = { name: 'a small button' }; - -export const Group = () => ( - - {}} pillar={Pillar.Culture} linkName=""> - Culture one - - - {}} pillar={Pillar.News} linkName=""> - News two - - - {}} pillar={Pillar.Sport} linkName=""> - Sport three - - -); -Group.story = { name: 'a group of buttons' }; - -export const IconLeft = () => ( - {}} - pillar={Pillar.News} - icon={} - iconSide="left" - linkName="" - > - Check to the left - -); -IconLeft.story = { name: 'with an icon to the left' }; - -export const IconRight = () => ( - {}} - pillar={Pillar.News} - icon={} - iconSide="right" - linkName="" - > - Check to the right - -); -IconRight.story = { name: 'with an icon to the right' }; - -export const Grey = () => ( - { - alert('Clicked!'); - }} - linkName="" - > - This is how I look when no pillar is passed - -); -Grey.story = { name: 'a button with no pillar' }; - -export const Background = () => ( -
- {}} pillar={Pillar.Lifestyle} linkName=""> - How do I look on a grey background? - -
-); -Background.story = { name: 'on a grey background' }; diff --git a/src/components/ButtonLink/ButtonLink.tsx b/src/components/ButtonLink/ButtonLink.tsx deleted file mode 100644 index 2fb65a72..00000000 --- a/src/components/ButtonLink/ButtonLink.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import React from 'react'; -import { css, cx } from 'emotion'; - -import { palette, neutral } from '@guardian/src-foundations'; -import { textSans } from '@guardian/src-foundations/typography'; -import { Button } from '@guardian/src-button'; - -import { Theme } from '@guardian/types'; - -import { pillarToString } from '../../lib/pillarToString'; - -type Props = { - onClick: () => void; - pillar?: Theme; - size?: 'xsmall' | 'small' | 'default'; - icon?: JSX.Element; - iconSide?: 'left' | 'right'; - children: string | JSX.Element; - linkName: string; -}; - -const buttonOverrides = (pillar?: Theme) => { - const pillarString = pillar || pillar === 0 ? pillarToString(pillar) : null; - return css` - button { - ${textSans.xxsmall({ - fontWeight: pillarString ? 'bold' : 'regular', - })} - color: ${pillarString ? palette[pillarString][400] : neutral[46]}; - background-color: transparent; - height: 18px; - min-height: 18px; - /* Radius 0 is used to style focus halo */ - border-radius: 0; - - :hover { - text-decoration: underline; - text-decoration-color: ${pillarString - ? palette[pillarString][400] - : neutral[46]}; - } - } - `; -}; - -export const ButtonLink = ({ - pillar, - onClick, - size = 'default', - icon, - iconSide, - children, - linkName, -}: Props) => ( -
- -
-); diff --git a/src/components/Comment/Comment.tsx b/src/components/Comment/Comment.tsx index fd505b65..d87018b8 100644 --- a/src/components/Comment/Comment.tsx +++ b/src/components/Comment/Comment.tsx @@ -7,6 +7,7 @@ import { neutral, border } from '@guardian/src-foundations/palette'; import { textSans } from '@guardian/src-foundations/typography'; import { Link } from '@guardian/src-link'; import { SvgIndent } from '@guardian/src-icons'; +import { Button } from '@guardian/src-button'; import { Theme } from '@guardian/types'; @@ -17,7 +18,6 @@ import { Timestamp } from '../Timestamp/Timestamp'; import { Avatar } from '../Avatar/Avatar'; import { Row } from '../Row/Row'; import { Column } from '../Column/Column'; -import { ButtonLink } from '../ButtonLink/ButtonLink'; import { CommentType, UserProfile } from '../../types'; import { pickComment, unPickComment } from '../../lib/api'; @@ -224,6 +224,38 @@ const cssReplyToWrapper = css` } `; +const buttonLinkPillarBaseStyles = (pillar: Theme) => css` + button { + color: ${palette[pillarToString(pillar)][400]}; + background-color: transparent; + height: 18px; + min-height: 18px; + /* Radius 0 is used to style focus halo */ + border-radius: 0; + + :hover { + text-decoration: underline; + text-decoration-color: ${palette[pillarToString(pillar)][400]}; + } + } +`; + +const buttonLinkBaseStyles = css` + button { + color: ${neutral[46]}; + background-color: transparent; + height: 18px; + min-height: 18px; + /* Radius 0 is used to style focus halo */ + border-radius: 0; + + :hover { + text-decoration: underline; + text-decoration-color: ${neutral[46]}; + } + } +`; + // In order to show as much of the usernames as possible without fixed widths: // - First label should shrink to contents but be no bigger than 60% // - Second label should never force first label less than its contents if less than 60% @@ -493,13 +525,25 @@ export const Comment = ({ <>All posts from this user have been muted on this device. - toggleMuteStatus(comment.userProfile.userId)} - linkName="unmute-user" - size="xsmall" +
- Unmute? - + +

)} @@ -528,16 +572,26 @@ export const Comment = ({ <> {/* If user is not logged in we link to the login page */} {user ? ( -
- +
) : (
e.name === 'Staff') && user.userId !== comment.userProfile.userId && ( - - {isHighlighted ? 'Unpick' : 'Pick'} - + +
)} {/* You can't mute unless logged in and you can't yourself */} {user && comment.userProfile.userId !== user.userId ? ( - - toggleMuteStatus(comment.userProfile.userId) - } - size="xsmall" - linkName="mute-user" +
- Mute - + +
) : ( <> )} - - Report - + +
{showAbuseReportForm && (
css` + button { + color: ${palette[pillarToString(pillar)][400]}; + background-color: transparent; + height: 18px; + min-height: 18px; + /* Radius 0 is used to style focus halo */ + border-radius: 0; + + :hover { + text-decoration: underline; + text-decoration-color: ${palette[pillarToString(pillar)][400]}; + } + } +`; + +const buttonLinkBaseStyles = css` + button { + color: ${neutral[46]}; + background-color: transparent; + height: 18px; + min-height: 18px; + /* Radius 0 is used to style focus halo */ + border-radius: 0; + + :hover { + text-decoration: underline; + text-decoration-color: ${neutral[46]}; + } + } +`; + export const CommentReplyPreview = ({ pillar, commentBeingRepliedTo, @@ -95,15 +128,26 @@ export const CommentReplyPreview = ({ {commentBeingRepliedTo.userProfile.displayName}
- setDisplayReplyComment(!displayReplyComment)} - linkName={ - displayReplyComment ? 'reply-comment-hide' : 'reply-comment-show' - } +
- {displayReplyComment ? 'Hide Comment' : 'Show comment'} - + +
{displayReplyComment && ( - setDisplayReplyComment(!displayReplyComment)} - linkName="hide-comment" +
- Hide Comment - + +
); };