forked from carbon-design-system/carbon-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
329 changed files
with
1,847 additions
and
5,997 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 |
---|---|---|
@@ -1,19 +1,19 @@ | ||
# Default to system one design and one dev | ||
|
||
* @carbon-design-system/developers-system-reviewers @carbon-design-system/design | ||
* @carbon-design-system/developers-system @carbon-design-system/design | ||
|
||
# Diana Tran is the owner for Sustainability Software Patterns | ||
|
||
src/pages/community/patterns/login-pattern/* @dianatran18 @lukefirth | ||
|
||
# Eliad Moosavi and Natasha Decoste are the code owners for Data Visualization | ||
|
||
src/pages/data-visualization/* @theiliad # @natashadecoste | ||
src/pages/data-visualization/* @theiliad @natashadecoste | ||
|
||
# Zvonimir Fras for Angular tutorial | ||
|
||
/src/pages/tutorial/angular/* @zvonimirfras | ||
|
||
# Lee Chase for Vue tutorial | ||
|
||
/src/pages/tutorial/vue/* @lee-chase | ||
/src/pages/tutorial/vue/* @lee-chase |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -113,6 +113,3 @@ build-timestamp | |
|
||
.now | ||
.vercel | ||
|
||
# Yarn install state | ||
.yarn/install-state.gz |
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,93 @@ | ||
import { NowRequest, NowResponse } from '@now/node'; | ||
import fetch, { FetchError } from 'node-fetch'; | ||
|
||
import { WebClient } from '@slack/web-api'; | ||
|
||
require('dotenv').config(); //eslint-disable-line @typescript-eslint/no-var-requires | ||
|
||
const permittedOrigins = [ | ||
'https://www.carbondesignsystem.com', | ||
'https://w3.ibm.com', | ||
]; | ||
|
||
module.exports = async (req: NowRequest, res: NowResponse) => { | ||
if (req.cookies.survey_recently_submitted) { | ||
return res.json({ error: 'Survey recently submitted.' }); | ||
} | ||
|
||
if (!process.env.SURVEYGIZMO_REQUEST_URI) { | ||
return res.json({ error: 'Invalid SurveyGizmo request uri.' }); | ||
} | ||
|
||
if (!process.env.SLACK_TOKEN || !process.env.SLACK_CHANNEL) { | ||
return res.json({ error: 'Invalid Slack token or channel.' }); | ||
} | ||
|
||
// Initialize Slack web client | ||
const slack = new WebClient(process.env.SLACK_TOKEN); | ||
|
||
// Only allow requests from specified urls | ||
const { origin } = req.headers; | ||
if (!origin || Array.isArray(origin) || !permittedOrigins.includes(origin)) { | ||
return res.json({ | ||
error: `Request sent from unauthorized origin: ${origin}`, | ||
}); | ||
} | ||
|
||
// Prepare data for SurveyGizmo | ||
const { experience, comment, path } = JSON.parse(req.body); | ||
const surveyBody = JSON.stringify({ | ||
data: { | ||
'2': { value: experience }, | ||
'3': { value: comment }, | ||
'4': { value: path }, | ||
}, | ||
}); | ||
|
||
await fetch(process.env.SURVEYGIZMO_REQUEST_URI, { | ||
method: 'PUT', | ||
body: surveyBody, | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}).catch((error: FetchError) => res.json({ error: error.message })); | ||
|
||
// Prepare data for Slack | ||
const emoji = | ||
experience === 'Negative' | ||
? ':disappointed:' | ||
: experience === 'Neutral' | ||
? ':neutral_face:' | ||
: ':grinning:'; | ||
|
||
const blocks = [ | ||
{ | ||
type: 'section', | ||
text: { | ||
type: 'mrkdwn', | ||
text: `${emoji} *${experience}* web page experience ${emoji}`, | ||
}, | ||
}, | ||
]; | ||
|
||
if (path) { | ||
blocks[0].text.text += `\n>*Path:*\n>${path}`; | ||
} | ||
|
||
if (comment) { | ||
blocks[0].text.text += `\n>*Comment:*\n>${comment}`; | ||
} | ||
|
||
await slack.chat.postMessage({ | ||
blocks, | ||
channel: process.env.SLACK_CHANNEL, | ||
} as any); | ||
|
||
// Set a "recently submitted" cookie that expires after one minute to mitigate spam | ||
res.setHeader( | ||
'Set-Cookie', | ||
'survey_recently_submitted=true; Max-Age=60; Secure; SameSite=None' | ||
); | ||
|
||
res.status(200).send('success'); | ||
}; |
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
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 |
---|---|---|
@@ -1,12 +1,3 @@ | ||
:global(.page-table) .tag { | ||
margin-left: 0; | ||
} | ||
|
||
:global(.cds--popover-container .cds--definition-term) { | ||
border: none; | ||
} | ||
|
||
:global(.cds--popover-container .cds--definition-term) .tag span { | ||
border-block-end: 1px dotted $border-strong; | ||
cursor: pointer; | ||
} |
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
Oops, something went wrong.