Skip to content

Commit f564b09

Browse files
authored
Merge pull request #990 from civictechindex/edit-add-project-949
Update instructions for adding tags
2 parents 10f8ae2 + 9f6b9f3 commit f564b09

File tree

2 files changed

+46
-8
lines changed

2 files changed

+46
-8
lines changed

cypress/integration/pages/how-to-add.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,13 @@ describe('How To Add Page', () => {
1010
it('middle section loads', () => {
1111
cy.contains('After you have finished adding your tags, click Save Changes');
1212
});
13+
14+
it('copies correct URL', () => {
15+
cy.get('[data-cy=copy-link').click();
16+
cy.window().then((win) => {
17+
win.navigator.clipboard.readText().then((text) => {
18+
expect(text).to.eq(win.location.href);
19+
});
20+
});
21+
});
1322
});

src/pages/HowToUse/index.js

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
11
import React from 'react';
22
import Box from '@material-ui/core/Box';
33
import Container from '@material-ui/core/Container';
4+
import Link from '@material-ui/core/Link';
45
import Typography from '@material-ui/core/Typography';
56
import { makeStyles } from '@material-ui/core/styles';
67
import GenericHeaderSection from '../../components/GenericHeaderSection';
78
import ImageComponent from '../../components/ImageComponent';
89
import SettingsGearIcon from '../../icons/SettingsGearIcon';
10+
import { useClipboard } from 'use-clipboard-copy';
911

1012
const useStyles = makeStyles((theme) => ({
1113
boxContainer: {
12-
padding: '64px 32px',
14+
padding: '32px',
1315
margin: 'auto',
16+
[theme.breakpoints.down('md')]: {
17+
padding: '32px 0',
18+
},
1419
},
1520
summary: {
16-
marginBottom: '30px',
21+
fontSize: '24px',
22+
margin: '32px auto 64px',
1723
textAlign: 'justify',
18-
[theme.breakpoints.down('xs')]: {
19-
fontSize: '14px',
24+
width: '66%',
25+
[theme.breakpoints.down('md')]: {
26+
fontSize: '20px',
27+
margin: '0px auto 32px',
28+
width: '100%',
2029
},
2130
},
2231
typoStyle: {
2332
fontWeight: '400',
2433
textAlign: 'justify',
34+
'& a:visited': {
35+
color: theme.palette.secondary.main,
36+
},
2537
[theme.breakpoints.down('xs')]: {
2638
fontSize: '14px',
2739
},
@@ -32,11 +44,16 @@ const useStyles = makeStyles((theme) => ({
3244
}));
3345

3446
const HowToUse = () => {
47+
const clipboard = useClipboard();
3548
const classes = useStyles();
3649
const breadCrumbLinks = [
3750
{ href: '/home', name: 'Home' },
3851
{ href: '/join-index/how-to-add', name: 'How to Add Your Project' },
3952
];
53+
const copyText = (e, text) => {
54+
e.preventDefault();
55+
clipboard.copy(text);
56+
};
4057
return (
4158
<Box className='pageContainer'>
4259
<Box className='boxBackground'>
@@ -52,10 +69,10 @@ const HowToUse = () => {
5269
<Box className={classes.boxContainer}>
5370
<Box>
5471
<Typography variant='body1' className={classes.summary}>
55-
By adding the civictechindex topic tag to your project, we can
56-
create a continuously updated repository for all civic tech
57-
enthusiasts to find open source projects to model, connect with,
58-
and learn from.
72+
By adding the <b>&apos;civictechindex&apos; </b>
73+
topic tag to your project, we can create a continuously updated
74+
repository for all civic tech enthusiasts to find open source
75+
projects to model, connect with, and learn from.
5976
</Typography>
6077
</Box>
6178
<Box>
@@ -70,6 +87,18 @@ const HowToUse = () => {
7087
don’t have &quot;edit repository settings&quot; privileges (and
7188
can’t perform the steps below).
7289
</Typography>
90+
<Typography variant='body1' className={classes.typoStyle}>
91+
Click{' '}
92+
<Link
93+
data-cy='copy-link'
94+
onClick={(e) => copyText(e, window.location.href)}
95+
key='join-index'
96+
href='/join-index/how-to-add'
97+
>
98+
here
99+
</Link>{' '}
100+
to copy the url for this page to send to your GitHub admin.
101+
</Typography>
73102
</Box>
74103
<ImageComponent src='/images/instructions-step1.png' alt='Step 1' />
75104
<Box>

0 commit comments

Comments
 (0)