-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Social logos | Add TypeScript support (#37528)
* Update components * Remove unnecessary class prop from threads logo * Update tools to handle TS * Add changelog * Fix typescript and glob version * Sort generated icons list * Sort the auto generated icons * Fix up versions * Move noEmit to CLI for project-structure constraints Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/9229474530 Upstream-Ref: Automattic/jetpack@d557c9d
- Loading branch information
1 parent
065e7cf
commit a9d5013
Showing
19 changed files
with
633 additions
and
509 deletions.
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import './example.css'; | ||
/** | ||
* An example React component that displays all the social logos. | ||
* | ||
* @returns {React.Component} The `SocialLogosExample` component. | ||
*/ | ||
declare function SocialLogosExample(): import("react/jsx-runtime").JSX.Element; | ||
export default SocialLogosExample; |
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,32 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
const react_1 = require("react"); | ||
const social_logo_1 = require("./social-logo"); | ||
const social_logo_data_1 = require("./social-logo-data"); | ||
require("./example.css"); | ||
/** | ||
* An example React component that displays all the social logos. | ||
* | ||
* @returns {React.Component} The `SocialLogosExample` component. | ||
*/ | ||
function SocialLogosExample() { | ||
const [useSmallIcons, setUseSmallIcons] = (0, react_1.useState)(false); | ||
const [showIconNames, setShowIconNames] = (0, react_1.useState)(true); | ||
const iconSize = useSmallIcons ? 24 : 48; | ||
const handleClick = name => { | ||
const code = `<SocialLogo icon="${name}" size="${iconSize}" />`; | ||
window.prompt('Copy component code:', code); | ||
}; | ||
const handleSmallIconsToggle = e => { | ||
setUseSmallIcons(e.target.checked); | ||
}; | ||
const handleIconNamesToggle = e => { | ||
setShowIconNames(e.target.checked); | ||
}; | ||
const allSocialLogos = social_logo_data_1.SocialLogoData.map(logo => { | ||
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(social_logo_1.SocialLogo, { icon: logo.name, size: iconSize, onClick: handleClick.bind(this, logo.name) }), showIconNames && (0, jsx_runtime_1.jsx)("p", { children: logo.name })] }, logo.name)); | ||
}); | ||
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "social-logos-example" }, { children: [(0, jsx_runtime_1.jsx)("h1", { children: "Social Logos" }), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "display-control-group" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "display-control" }, { children: [(0, jsx_runtime_1.jsx)("h4", { children: "Small icons" }), (0, jsx_runtime_1.jsxs)("label", Object.assign({ className: "switch" }, { children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", onChange: handleSmallIconsToggle, checked: useSmallIcons }), (0, jsx_runtime_1.jsx)("span", { className: "handle" })] }))] })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "display-control" }, { children: [(0, jsx_runtime_1.jsx)("h4", { children: "Icon names" }), (0, jsx_runtime_1.jsxs)("label", Object.assign({ className: "switch" }, { children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", onChange: handleIconNamesToggle, checked: showIconNames }), (0, jsx_runtime_1.jsx)("span", { className: "handle" }), (0, jsx_runtime_1.jsx)("span", { className: "switch-label", "data-on": "On", "data-off": "Off" })] }))] }))] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "icons" }, { children: allSocialLogos })), (0, jsx_runtime_1.jsx)("p", { children: (0, jsx_runtime_1.jsx)("a", Object.assign({ href: "https://github.com/Automattic/social-logos" }, { children: "GitHub" })) })] }))); | ||
} | ||
exports.default = SocialLogosExample; |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* Export components. | ||
*/ | ||
export * from './social-logo'; | ||
export { SocialLogo as default } from './social-logo'; | ||
export { SocialLogoData } from './social-logo-data'; |
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,25 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SocialLogoData = exports.default = void 0; | ||
/** | ||
* Export components. | ||
*/ | ||
__exportStar(require("./social-logo"), exports); | ||
var social_logo_1 = require("./social-logo"); | ||
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return social_logo_1.SocialLogo; } }); | ||
var social_logo_data_1 = require("./social-logo-data"); | ||
Object.defineProperty(exports, "SocialLogoData", { enumerable: true, get: function () { return social_logo_data_1.SocialLogoData; } }); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.