You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the useCopyToClipboard.ts hook that already exists.
onClick of the Copy to clipboard button, show the Notification and copy the contents of the current tab using the hook.
Disable the button's click handler functionality during this state
The @heroicons/react module has the icon document-duplicate available for use. This is a slight variant of the Figma, as the icon in the design is not available.
Add a storybook story file components/Common/Codebox/index.stories.tsx which exercises each of the component's states.
Note: per a design decision, we will only use dark mode (Nord theme) of shiki, despite the screenshot and figma still displaying a light mode
Copy to clipboard must be internationalized. Add a new key components.common.codebox.copy to the i18n/locales/en.json file. FormattedMessage from react-intl should be used to reference the key. Look for examples elsewhere in the codebase.
Suggested props include:
language (string): displays in the bottom left of the Codebox, labeling the type of content
linkText (string, optional): displays in the top-right of the Codebox if present and linkUrl
linkUrl (typeof next/link or ??, optional): the location the user navigates to when linkText is clicked
children in the form of Tabs and Tabs
Example of linkText and linkUrl:
There are 3 states to capture within styles and stories:
Create a
CodeBoxcomponent using the new figma design (direct link).This is the final port of the Codebox component recently deleted
Before You Start...
Details
❓ Not sure where to start breaking down the figma? Read this short guide
🌐 This story requires some internationalization support. Slow down!
CodeBoxwithin theCommondirectory that contains all the new code.Buttoncomponent introduced within feat: addButtoncomponent #5783Notificationcomponent introduced within CreateNotificationComponent #5948TabsandTabcomponents introduced within CreateTabandTabscomponents #5817 to support 1 to many filesuseCopyToClipboard.tshook that already exists.onClickof theCopy to clipboardbutton, show theNotificationand copy the contents of the current tab using the hook.@heroicons/reactmodule has the icondocument-duplicateavailable for use. This is a slight variant of the Figma, as the icon in the design is not available.components/Common/Codebox/index.stories.tsxwhich exercises each of the component's states.Copy to clipboardmust be internationalized. Add a new keycomponents.common.codebox.copyto thei18n/locales/en.jsonfile.FormattedMessagefromreact-intlshould be used to reference the key. Look for examples elsewhere in the codebase.Suggested props include:
language(string): displays in the bottom left of the Codebox, labeling the type of contentlinkText(string, optional): displays in the top-right of the Codebox if present andlinkUrllinkUrl(typeof next/linkor ??, optional): the location the user navigates to whenlinkTextis clickedchildrenin the form ofTabsandTabsExample of

linkTextandlinkUrl:There are 3 states to capture within styles and stories:
linkTextandlinkUrlpresent