Skip to content

Commit

Permalink
feat(code-block): create Code Block Package
Browse files Browse the repository at this point in the history
Co-authored-by: Shadi <TheSisb@users.noreply.github.com>
Co-authored-by: gloriliale <77117846+gloriliale@users.noreply.github.com>
Co-authored-by: Lee White <leewhite128@gmail.com>
  • Loading branch information
4 people committed Aug 29, 2022
1 parent 737423f commit aec5a9a
Show file tree
Hide file tree
Showing 43 changed files with 2,555 additions and 13 deletions.
6 changes: 6 additions & 0 deletions .changeset/great-tools-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@twilio-paste/code-block': major
'@twilio-paste/core': minor
---

[Code Block] create a new CodeBlock component, which allows you to display readable blocks of code 🎉
6 changes: 6 additions & 0 deletions .changeset/lucky-balloons-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@twilio-paste/core': minor
'@twilio-paste/syntax-highlighter': major
---

[Syntax Highlighter] Create a new library, @twilio-paste/syntax-highlighter
6 changes: 6 additions & 0 deletions .changeset/tall-falcons-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@twilio-paste/button': patch
'@twilio-paste/core': patch
---

[Button] support <Button as='a' variant='inverse'>
2 changes: 2 additions & 0 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"/packages/paste-core/components/chat-log",
"/packages/paste-core/components/checkbox",
"/packages/paste-libraries/clipboard-copy",
"/packages/paste-core/components/code-block",
"/packages/paste-color-contrast-utils",
"/packages/paste-core/components/combobox",
"/packages/paste-core/primitives/combobox",
Expand Down Expand Up @@ -65,6 +66,7 @@
"/packages/paste-style-props",
"/packages/paste-libraries/styling",
"/packages/paste-core/components/switch",
"/packages/paste-libraries/syntax-highlighter",
"/packages/paste-core/components/table",
"/packages/paste-core/components/tabs",
"/packages/paste-core/primitives/tabs",
Expand Down
9 changes: 9 additions & 0 deletions @types/react-syntax-highlighter/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
declare module 'react-syntax-highlighter/dist/esm/languages/prism/shell-session' {
const language: any;
export default language;
}

declare module 'react-syntax-highlighter/dist/esm/styles/prism/night-owl' {
const style: { [key: string]: React.CSSProperties };
export default style;
}
1 change: 1 addition & 0 deletions cypress/integration/sitemap-vrt/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const SITEMAP = [
'/components/breadcrumb/',
'/components/badge/',
'/components/callout/',
'/components/code-block/',
'/components/card/',
'/components/chat-log/',
'/components/checkbox/',
Expand Down
2 changes: 2 additions & 0 deletions packages/paste-codemods/tools/.cache/mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"Checkbox": "@twilio-paste/core/checkbox",
"CheckboxDisclaimer": "@twilio-paste/core/checkbox",
"CheckboxGroup": "@twilio-paste/core/checkbox",
"CodeBlock": "@twilio-paste/core/code-block",
"CodeBlockGroup": "@twilio-paste/core/code-block",
"Combobox": "@twilio-paste/core/combobox",
"ComboboxInputWrapper": "@twilio-paste/core/combobox",
"ComboboxListbox": "@twilio-paste/core/combobox",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,6 @@ describe('Button', () => {
</Button>
)
).toThrow();
expect(() =>
render(
<Button as="a" href="#" variant="inverse">
Go to Paste
</Button>
)
).toThrow();
spy.mockRestore();
});

Expand Down
4 changes: 2 additions & 2 deletions packages/paste-core/components/button/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ const handlePropValidation = ({
if (variant === 'link' || variant === 'inverse_link') {
throw new Error(`[Paste: Button] Using Button component as an Anchor. Use the Paste Anchor component instead.`);
}
if (variant !== 'primary' && variant !== 'secondary' && variant !== 'reset') {
throw new Error(`[Paste: Button] <Button as="a"> only works with the following variants: primary or secondary.`);
if (variant !== 'primary' && variant !== 'secondary' && variant !== 'reset' && variant !== 'inverse') {
throw new Error(`[Paste: Button] <Button as="a"> only works with the following variants: primary and secondary.`);
}
if (disabled || loading) {
throw new Error(`[Paste: Button] <Button as="a"> cannot be disabled or loading.`);
Expand Down
Empty file.
Loading

0 comments on commit aec5a9a

Please sign in to comment.