Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task/TUP-272 - core components fixup #7

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2ed29dc
feat(core-components): copy & polish from cepv2
wesleyboar Jun 8, 2022
8260275
feat(comp…s): cepv2 update but w/ new styles paths
wesleyboar Jun 8, 2022
10b3838
feat(comp…s): 2nd cepv2 update (no path updates)
wesleyboar Jun 8, 2022
af596ef
feat(comp…s): cepv2 update: button tests, unmerged
wesleyboar Jun 8, 2022
a158f0e
fix(comp…s): fix core-styles paths (libs → lib)
wesleyboar Jun 8, 2022
97d858d
feat(comp…s): update all paths to core-styles src
wesleyboar Jun 8, 2022
fe84b23
feat(comp…s): fix paths that can use styles dist
wesleyboar Jun 8, 2022
aab21ba
fix(styles): all src/lib imports to use rel. paths
wesleyboar Jun 8, 2022
213ca2b
fix(styles): src/lib rel. paths need no _imports/
wesleyboar Jun 8, 2022
ee30835
fix(tup-ui): load CSS from correct path
wesleyboar Jun 10, 2022
7a9288c
Merge branch 'main' into task/tup-272-core-components
wesleyboar Jun 10, 2022
fc58dc4
Convert Button and dependencies to TS
jchuahtacc Jun 13, 2022
cc2c07e
Add reactstrap global
jchuahtacc Jun 13, 2022
34acd97
Replace temporary Message component to exports
jchuahtacc Jun 13, 2022
f736fcd
Use Button from core-components in tup-ui
jchuahtacc Jun 13, 2022
b1b4d22
Added babel-plugin-postcss for core-components
jchuahtacc Jun 13, 2022
c34cb01
Formatting
jchuahtacc Jun 13, 2022
febbc0f
linting
jchuahtacc Jun 13, 2022
f8ec70a
Formatting
jchuahtacc Jun 13, 2022
34dedf9
Merge branch 'milestone/001--core-components' into task/TUP-272--core…
jchuahtacc Jun 15, 2022
1105440
Task/tup 272 core components vite (#8)
jchuahtacc Jun 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@


# Tacc

This project was generated using [Nx](https://nx.dev).

Things to try:

- `npx nx serve tup-ui` to run the app
- `npx nx build core-components` to create a distributable library for the core components.
- `npx nx build core-styles` to build the style library.
Expand Down Expand Up @@ -84,8 +83,6 @@ Run `nx graph` to see a diagram of the dependencies of your projects.

Visit the [Nx Documentation](https://nx.dev) to learn more.



## ☁ Nx Cloud

### Distributed Computation Caching & Distributed Task Execution
Expand Down
2 changes: 1 addition & 1 deletion apps/tup-ui/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"options": {
"commands": [
{
"command": "npx vite build"
"command": "npx vite build --emptyOutDir"
}
],
"cwd": "apps/tup-ui"
Expand Down
10 changes: 7 additions & 3 deletions apps/tup-ui/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react';
import { Message } from '@tacc/core-components';
import { Button, Message } from '@tacc/core-components';

function App() {
const [count, setCount] = useState(0);
Expand All @@ -10,9 +10,13 @@ function App() {
<p>Hello Vite + React!</p>
<Message />
<p>
<button type="button" onClick={() => setCount((count) => count + 1)}>
<Button
onClick={() => setCount((count) => count + 1)}
size="long"
type="primary"
>
count is: {count}
</button>
</Button>
</p>
<p>
Edit <code>App.tsx</code> and save to test HMR updates.
Expand Down
4 changes: 2 additions & 2 deletions apps/tup-ui/src/styles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Global stylesheets may `@import` project stylesheets, e.g.:
**`index.css`**

```
@import url('styles/.../settings/color.css');
@import url('@tacc/core-styles/.../settings/color.css');
```

### Import from Component Stylesheets
Expand All @@ -24,7 +24,7 @@ Component stylesheets may `@import` project stylesheets, e.g.:
**`components/(.../)SomeProjectComponent.module.css`**

```
@import url('styles/tools/media-queries.css');
@import url('@tacc/core-styles/.../tools/media-queries.css');

@media screen and (--short-and-above) and (--medium-and-above) {
selector {
Expand Down
3 changes: 1 addition & 2 deletions libs/core-components/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
[
"@nrwl/react/babel",
{
"runtime": "automatic",
"useBuiltIns": "usage"
"runtime": "automatic"
}
]
],
Expand Down
16 changes: 16 additions & 0 deletions libs/core-components/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is used by:
# 1. autoprefixer to adjust CSS to support the below specified browsers
# 2. babel preset-env to adjust included polyfills
#
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
#
# If you need to support different browsers in production, you may tweak the list below.

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major version
last 2 iOS major versions
Firefox ESR
not IE 9-11 # For IE 9-11 support, remove 'not'.
7 changes: 0 additions & 7 deletions libs/core-components/README.md

This file was deleted.

3 changes: 2 additions & 1 deletion libs/core-components/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ export default {
displayName: 'core-components',
preset: '../../jest.preset.js',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
'^.+\\.[tj]sx?$': 'babel-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/libs/core-components',
coverageDirectory: '../../coverage/apps/tup-ui',
};
12 changes: 11 additions & 1 deletion libs/core-components/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"name": "@tacc/core-components",
"version": "0.0.1"
"files": [
"dist"
],
"main": "./dist/core-components.umd.js",
"module": "./dist/core-components.es.js",
"exports": {
".": {
"import": "./dist/core-components.umd.js",
"require": "./dist/core-components.umd.js"
}
}
}
34 changes: 18 additions & 16 deletions libs/core-components/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/core-components/src",
"projectType": "library",
"tags": [],
"targets": {
"serve": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "npx vite"
}
],
"cwd": "libs/core-components"
}
},
"build": {
"executor": "@nrwl/web:rollup",
"outputs": ["{options.outputPath}"],
"executor": "nx:run-commands",
"options": {
"outputPath": "dist/libs/core-components",
"tsConfig": "libs/core-components/tsconfig.lib.json",
"project": "libs/core-components/package.json",
"entryFile": "libs/core-components/src/index.ts",
"external": ["react/jsx-runtime"],
"rollupConfig": "@nrwl/react/plugins/bundle-rollup",
"compiler": "babel",
"assets": [
"commands": [
{
"glob": "libs/core-components/README.md",
"input": ".",
"output": "."
"command": "npx vite build --emptyOutDir"
}
]
],
"cwd": "libs/core-components"
}
},
"lint": {
Expand All @@ -39,5 +40,6 @@
"passWithNoTests": true
}
}
}
},
"tags": []
}
3 changes: 3 additions & 0 deletions libs/core-components/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
export { default as Button } from './lib/Button';
export { default as Icon } from './lib/Icon';
export { default as LoadingSpinner } from './lib/LoadingSpinner';
export { default as Message } from './lib/core-components';
57 changes: 57 additions & 0 deletions libs/core-components/src/lib/Button/Button.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
.root {
composes: c-button from '@tacc/core-styles/dist/components/c-button.css';
}

.primary {
composes: c-button--primary from '@tacc/core-styles/dist/components/c-button.css';
}
.secondary {
composes: c-button--secondary from '@tacc/core-styles/dist/components/c-button.css';
}
.tertiary {
composes: c-button--tertiary from '@tacc/core-styles/dist/components/c-button.css';
}
.active {
composes: c-button--is-active from '@tacc/core-styles/dist/components/c-button.css';
}

.size-small {
composes: c-button--size-small from '@tacc/core-styles/dist/components/c-button.css';
}
.width-short {
composes: c-button--width-short from '@tacc/core-styles/dist/components/c-button.css';
}
.width-medium {
composes: c-button--width-medium from '@tacc/core-styles/dist/components/c-button.css';
}
.width-long {
composes: c-button--width-long from '@tacc/core-styles/dist/components/c-button.css';
}

.as-link {
composes: c-button--as-link from '@tacc/core-styles/dist/components/c-button.css';
}

.icon--before {
composes: c-button__icon--before from '@tacc/core-styles/dist/components/c-button.css';
}
.icon--after {
composes: c-button__icon--after from '@tacc/core-styles/dist/components/c-button.css';
}

.loading {
composes: c-button--is-busy from '@tacc/core-styles/dist/components/c-button.css';
}
.root {
position: relative;
}
.root .loading-over-button {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

.text {
composes: c-button__text from '@tacc/core-styles/dist/components/c-button.css';
}
Loading