{"id":19170289,"url":"https://github.com/sashadev-sky/widgetry","last_synced_at":"2026-04-11T02:55:30.297Z","repository":{"id":38805500,"uuid":"162519333","full_name":"sashadev-sky/Widgetry","owner":"sashadev-sky","description":"A collection of custom applets made with React https://sashadev-sky.github.io/Widgetry/dist","archived":false,"fork":false,"pushed_at":"2023-03-01T14:32:17.000Z","size":5884,"stargazers_count":0,"open_issues_count":8,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-04T00:18:11.419Z","etag":null,"topics":["babel","geolocation-api","google-maps-javascript-api","jss","jsx","material-ui","openweatherapi","react"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sashadev-sky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-20T03:04:37.000Z","updated_at":"2021-07-10T00:06:58.000Z","dependencies_parsed_at":"2024-11-09T10:03:48.547Z","dependency_job_id":null,"html_url":"https://github.com/sashadev-sky/Widgetry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sashadev-sky%2FWidgetry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sashadev-sky%2FWidgetry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sashadev-sky%2FWidgetry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sashadev-sky%2FWidgetry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sashadev-sky","download_url":"https://codeload.github.com/sashadev-sky/Widgetry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240250405,"owners_count":19771784,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["babel","geolocation-api","google-maps-javascript-api","jss","jsx","material-ui","openweatherapi","react"],"created_at":"2024-11-09T09:53:34.722Z","updated_at":"2026-04-11T02:55:25.265Z","avatar_url":"https://github.com/sashadev-sky.png","language":"JavaScript","readme":"# React Widgetry\n\n- Set of reusable components made with React\n\n- Integrates various APIs onto a single platform for a user to have available at their fingertips\n\n- User-centered and fully responsive design\n\n---\n\n## Environment\n\n- React 16.14.0 (Framework)\n\n- Node 16.2.0 (Environment)\n\n- npm 7.13.0 (Package Manager)\n\n- Webpack 5.x (Bundler)\n\n- Babel 7.x (Transpiler)\n\n---\n\n## Setup\n\nIn the project directory, you can run:\n\n**Development**\n\n* `npm install` - Install dependencies\n\n* `npm start` - Runs the app in the development mode. Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.\n\n**Production**\n\n* `npm run build` - Builds the app for production to the `dist` folder. It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified.\n\n* `npm run serve` - Serves the production build.\n\n---\n\n## Components\n\n### Clock Widget\n\n- Analog clock component\n\n### Tabs Widget\n\n- Interactive tabs widget that updates panes\n\n- Useful for storing quick summaries or notes\n\n### Calculator Widget\n\n- Supports basic arithmetic operations\n\n### Weather Widget\n\n- Uses the [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API) to update the weather based on the user's current location\n\n- Uses the XMLHttpRequest object to make asynchronous HTTP requests to the [OpenWeatherMap API](https://openweathermap.org/)\n\n- Follows the W3C standard to only access user location upon user gesture\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003eGeolocation API\u003c/strong\u003e\u003c/summary\u003e\n\nOn a very basic level:\n\n  1. Check if Geolocation is supported:\n\n  ```JavaScript\n  if ('geolocation' in navigator) {\n  // geolocation is available\n  } else {\n  // geolocation IS NOT available\n  }\n  ```\n\n  2. If supported, run the `getCurrentPosition()` method asynchronously. If not, display a message to the user\n\n  3. If the `getCurrentPosition()` method is successful, it returns a `Position` object to the function specified in the parameter (cb)\n\n  4. The cb function references a `Coordinates` obj on the passed `Position` obj to access the `latitude` and `longitude` properties\n\n  \u003c/details\u003e\n\n### Explore Widget\n\n- Uses a wrapper to integrate the [Google Maps JavaScript API](https://developers.google.com/maps/documentation/javascript/tutorial) with React.\n\n- Uses the [Google Places API](https://developers.google.com/places/web-service/intro) to allow dynamic querying of cities all over the world on an interactive and responsive map.\n\n- Does not start off in your current location - it's meant for looking around\n\n- Standard Google map Features implemented:\n\n  - Autocomplete functionality for queries\n\n  - Location markers corresponding with information windows containing location data\n\n- Additional Custom features extending the API:\n\n  - Customized UI layer\n\n  - Ability to toggle search bar for a full map view\n\n  - Home button to always return the map to a set origin\n\n---\n\n## Styling\n\nDependencies:\n\n- `@material-ui/core` 4.11.4 (Styling)\n\n- `@material-ui/icons` 4.11.2 (Icons)\n\n- `clsx` 1.1.1\n\n### Material-UI's  `withStyles` \u0026 `makeStyles`\n\nMaterial-UI provides React components for faster and easier web development.\n\nIt is built with a CSS-in-JS solution, specifically **JSS** (**JavaScript Style Sheets**) - a high performance JavaScript to CSS compiler which works at runtime and server-side.\n\nThis project uses their **`withStyles`** function as part of their Higher-order component API.\n\n\u003cul\u003e\u003cli\u003e\u003cdetails\u003e\u003csummary\u003eExample - by calling \u003ccode\u003e\u003cb\u003ewithStyles(styles)(MyComponent)\u003c/b\u003e\u003c/code\u003e, you’re returning a new component that has a \u003ccode\u003e\u003cb\u003eclasses\u003c/b\u003e\u003c/code\u003e property. \u003c/summary\u003e\n\n```Javascript\nimport { withStyles } from '@material-ui/core/styles';\nimport Button from '@material-ui/core/Button';\n\nconst styles = {\n  root: {\n    background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)',\n    //...\n  },\n};\n\nfunction HigherOrderComponent(props) {\n  const { classes } = props;\n  return \u003cButton className={classes.root}\u003eHigher-order component\u003c/Button\u003e;\n};\n\nHigherOrderComponent.propTypes = {\n  classes: PropTypes.shape.isRequired,\n};\n\nexport default withStyles(styles)(HigherOrderComponent);\n```\n\n\u003c/li\u003e\u003c/ul\u003e\u003c/details\u003e\n\nMoving towards the pattern of using functional components and hooks, some componenents that already rely on state hooks leverage Material-UI style hooks with **`makeStyles()`**.\n\nThe **`useStyles()`** hook is built using the **`makeStyles()`** function—which takes the exact same styles argument as **`withStyles()`**.\n\n\u003cul\u003e\u003cli\u003e\u003cdetails\u003e\u003csummary\u003eExample - by calling \u003ccode\u003e\u003cb\u003euseStyles()\u003c/b\u003e \u003c/code\u003ewithin the component, you have your \u003ccode\u003e\u003cb\u003eclasses\u003c/b\u003e\u003c/code\u003eobject \u003c/summary\u003e:\n\n```Javascript\nimport { makeStyles } from '@material-ui/core/styles';\nimport Button from '@material-ui/core/Button';\n\nconst styles = {\n  root: {\n    background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)',\n    border: 0,\n    //...\n  },\n};\n\nconst useStyles = makeStyles(styles);\n\nexport function Hook(props) {\n  const classes = useStyles();\n  return \u003cButton className={classes.root}\u003eHook\u003c/Button\u003e;\n};\n```\n\n\u003c/details\u003e\u003c/li\u003e\u003c/ul\u003e\n\n### clsx's `clsx`\n\n`clsx` is a tiny utility for constructing `className` strings conditionally, making it easier to concatenate classes.\n\nIt is a faster \u0026 smaller drop-in replacement for the `classnames` module, which it shares almost an identical API with.\n\nreact-widgets uses it to create clean `className` declarations with the **`clsx`** function.\n\n\u003cdetails\u003e\u003csummary\u003eExample - this syntax means that some class will only be applied if a given condition evaluates to true.\u003c/summary\u003e\n\n```Javascript\nimport React from 'react';\nimport clsx from 'clsx';\n\nconst menuStyle = clsx({\n  [classes.root] : true, //always applies\n  [classes.menuOpen] : open //only when open === true\n});\n\nreturn (\n  \u003cdiv className={menuStyle}\u003e\n    {children}\n  \u003c/div\u003e\n);\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eExample 2 - another common use case is to achieve cleaner string interpolation.\u003c/summary\u003e\n\n\u003cbr\u003e\n\nInstead of\n\n```Javascript\n\u003cdiv className={`${classes.foo} ${classes.bar} ${classes.baz}`} /\u003e\n```\n\nYou can use it like this\n\n```Javascript\nconst { foo, bar, baz } = classes\n\u003cdiv className={clsx(foo, bar, baz)} /\u003e\n```\n\n\u003c/details\u003e\n\n---\n\n## Typechecking\n\n**`prop-types`**: nodejs library to set properties for components\n\n\u003cdetails\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\n```Javascript\nimport PropTypes from 'prop-types';\n\nclass ComponentName extends React.Component {\n  render() {\n    return (\n      \u003ch1\u003eHello, {this.props.name}\u003c/h1\u003e\n    );\n  }\n}\n\nComponentName.propTypes = {\n  name: PropTypes.string\n};\n\n```\n\n\u003c/details\u003e\n\n---\n\n### Concepts (Personal Use)\n\n---\n\n\u003cdetails\u003e\n  \u003csummary\u003eEvent Listeners\u003c/summary\u003e\n  \u003cbr/\u003e\n  Using ES6 arrow functions allows us to define event listeners inside of components without having to do\n  \u003ccode\u003ethis.listenerName = this.listenerName.bind(this);\u003c/code\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eJSS\u003c/summary\u003e\n  \u003cbr/\u003e\n  Using React with JSS for more powerful, declarative styling\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eHigher-Order Components (HOCs)\u003c/summary\u003e\n  \u003cbr/\u003e\n  \u003e \"Concretely, a higher-order component is a function that takes a component and returns a new component.\"\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eTypechecking with PropTypes\u003c/summary\u003e\n  \u003cbr/\u003e\n  \u003e \"React has some built-in typechecking abilities. To run typechecking on the props for a component, you can assign the special propTypes property.\"\n\u003c/details\u003e\n\n##### 1. Clock\n\n- Lifecycle methods\n\n##### 2. Tabs\n\n- Extracting components\n\n- Lists and Keys\n\n##### 3. Calculator\n\n- Lifting state up\n\n- Controlled inputs\n\n##### 4. Explore\n\n- Refs\n\n- Integrating third-party libraries\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsashadev-sky%2Fwidgetry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsashadev-sky%2Fwidgetry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsashadev-sky%2Fwidgetry/lists"}