From 597123c4a0e72a1a8837018ae8adeb82911c2ca1 Mon Sep 17 00:00:00 2001 From: Philip Obosi Date: Thu, 17 Feb 2022 03:03:51 +0200 Subject: [PATCH 1/3] feat: re-implement ui-component-library --- .../frontend/src/translations/tr.global.json | 4 +- packages/ui-component-library/.gitignore | 135 ++++++++++++++++++ .../ui-component-library/.storybook/main.js | 8 ++ .../.storybook/preview.js | 5 + packages/ui-component-library/LICENSE | 21 +++ packages/ui-component-library/README.md | 57 ++++++++ .../build-utils/babel-custom.js | 28 ++++ .../ui-component-library/example/.npmignore | 3 + .../ui-component-library/example/index.html | 14 ++ .../ui-component-library/example/index.tsx | 13 ++ .../ui-component-library/example/package.json | 24 ++++ .../example/tsconfig.json | 18 +++ packages/ui-component-library/package.json | 80 +++++++++++ .../ui-component-library/rollup.config.js | 89 ++++++++++++ .../src/components/Container/Container.tsx | 39 +++++ .../src/components/Container/index.ts | 1 + .../src/components/index.ts | 3 + packages/ui-component-library/src/index.ts | 3 + .../src/stitches.config.ts | 15 ++ .../src/styles/globalStyles.ts | 6 + .../ui-component-library/src/styles/index.ts | 4 + packages/ui-component-library/tsconfig.json | 25 ++++ 22 files changed, 593 insertions(+), 2 deletions(-) create mode 100644 packages/ui-component-library/.gitignore create mode 100644 packages/ui-component-library/.storybook/main.js create mode 100644 packages/ui-component-library/.storybook/preview.js create mode 100644 packages/ui-component-library/LICENSE create mode 100644 packages/ui-component-library/README.md create mode 100644 packages/ui-component-library/build-utils/babel-custom.js create mode 100644 packages/ui-component-library/example/.npmignore create mode 100644 packages/ui-component-library/example/index.html create mode 100644 packages/ui-component-library/example/index.tsx create mode 100644 packages/ui-component-library/example/package.json create mode 100644 packages/ui-component-library/example/tsconfig.json create mode 100644 packages/ui-component-library/package.json create mode 100644 packages/ui-component-library/rollup.config.js create mode 100644 packages/ui-component-library/src/components/Container/Container.tsx create mode 100644 packages/ui-component-library/src/components/Container/index.ts create mode 100644 packages/ui-component-library/src/components/index.ts create mode 100644 packages/ui-component-library/src/index.ts create mode 100644 packages/ui-component-library/src/stitches.config.ts create mode 100644 packages/ui-component-library/src/styles/globalStyles.ts create mode 100644 packages/ui-component-library/src/styles/index.ts create mode 100644 packages/ui-component-library/tsconfig.json diff --git a/packages/frontend/src/translations/tr.global.json b/packages/frontend/src/translations/tr.global.json index 966bb48380..1bfe7ad137 100644 --- a/packages/frontend/src/translations/tr.global.json +++ b/packages/frontend/src/translations/tr.global.json @@ -854,6 +854,7 @@ "error": "Genel anahtar erişimi reddedildi. Hiçbir hesap kurtarılmadı.
Devam etmek için, NEAR Cüzdanının genel anahtarınızı görmesine izin vermelisiniz. Lütfen tekrar deneyin.", "success": "" }, + "LackBalanceForState": "Bakiyeniz yetersiz olduğundan işleminizi gerçekleştiremiyoruz. Lütfen hesabınıza NEAR gönderip tekrar deneyin.", "NotEnoughBalance": "Hesabınızda bu işlem için yeterli bakiye yok.", "PROMPT_TWO_FACTOR": { "invalidCode": "Geçersiz 2FA kodu. Lütfen tekrar deneyin." @@ -893,8 +894,7 @@ "VERIFY_TWO_FACTOR": { "error": "İki Faktörlü Doğrulama kurulumu başarısız oldu. Lütfen tekrar deneyin.", "success": "İki Faktörlü Doğrulama başarıyla kuruldu!" - }, - "LackBalanceForState": "Bakiyeniz yetersiz olduğundan işleminizi gerçekleştiremiyoruz. Lütfen hesabınıza NEAR gönderip tekrar deneyin." + } }, "releaseNotesModal": { "desc": "Siz sordunuz, biz dinledik! En son güncelleme, bakiyelerin cüzdanda nasıl görüntülendiğini ve yeni hesaplar oluşturmanın daha kolay yollarını getiriyor.", diff --git a/packages/ui-component-library/.gitignore b/packages/ui-component-library/.gitignore new file mode 100644 index 0000000000..c7b97a34c0 --- /dev/null +++ b/packages/ui-component-library/.gitignore @@ -0,0 +1,135 @@ +*.log +.DS_Store +node_modules +.cache +dist +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp +.cache + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* diff --git a/packages/ui-component-library/.storybook/main.js b/packages/ui-component-library/.storybook/main.js new file mode 100644 index 0000000000..cf1ac4a9f9 --- /dev/null +++ b/packages/ui-component-library/.storybook/main.js @@ -0,0 +1,8 @@ +module.exports = { + stories: ['../stories/**/*.stories.@(ts|tsx|js|jsx)'], + addons: ['@storybook/addon-links', '@storybook/addon-essentials'], + // https://storybook.js.org/docs/react/configure/typescript#mainjs-configuration + typescript: { + check: true, // type-check stories during Storybook build + } +}; diff --git a/packages/ui-component-library/.storybook/preview.js b/packages/ui-component-library/.storybook/preview.js new file mode 100644 index 0000000000..29ae5f2e49 --- /dev/null +++ b/packages/ui-component-library/.storybook/preview.js @@ -0,0 +1,5 @@ +// https://storybook.js.org/docs/react/writing-stories/parameters#global-parameters +export const parameters = { + // https://storybook.js.org/docs/react/essentials/actions#automatically-matching-args + actions: { argTypesRegex: '^on.*' }, +}; diff --git a/packages/ui-component-library/LICENSE b/packages/ui-component-library/LICENSE new file mode 100644 index 0000000000..9b329adb21 --- /dev/null +++ b/packages/ui-component-library/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Near Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/ui-component-library/README.md b/packages/ui-component-library/README.md new file mode 100644 index 0000000000..6aa48d1ca0 --- /dev/null +++ b/packages/ui-component-library/README.md @@ -0,0 +1,57 @@ +# @near-wallet/ui-component-library +> The official component library for the NEAR Wallet + +[![NPM](https://img.shields.io/npm/v/ui-component-library.svg)](https://www.npmjs.com/package/ui-component-library) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) + +## Install + +```bash +npm install --save @near-wallet/ui-component-library +``` + +## Usage + +```tsx +import React, { Component } from 'react' + +import { Button } from '@near-wallet/ui-component-library' + +class Example extends Component { + render() { + return