-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: init ui masonry * feat: add masonry source
- Loading branch information
Showing
30 changed files
with
1,042 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,23 @@ | ||
module.exports = function (api) { | ||
api.cache(true); | ||
|
||
return { | ||
presets: [ | ||
[ | ||
'@nx/react/babel', | ||
{ | ||
runtime: 'automatic', | ||
// useBuiltIns: 'usage', | ||
}, | ||
], | ||
], | ||
plugins: [], | ||
env: { | ||
test: { | ||
presets: [ | ||
['module:@react-native/babel-preset', { useTransformReactJSX: true }], | ||
], | ||
}, | ||
}, | ||
}; | ||
}; |
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,7 @@ | ||
# masonry | ||
|
||
This library was generated with [Nx](https://nx.dev). | ||
|
||
## Running unit tests | ||
|
||
Run `nx test masonry` to execute the unit tests via [Jest](https://jestjs.io). |
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,23 @@ | ||
const nx = require('@nx/eslint-plugin'); | ||
const baseConfig = require('../../eslint.config.js'); | ||
|
||
module.exports = [ | ||
...baseConfig, | ||
{ | ||
files: ['**/*.json'], | ||
rules: { | ||
'@nx/dependency-checks': [ | ||
'error', | ||
{ ignoredFiles: ['{projectRoot}/eslint.config.{js,cjs,mjs}'] }, | ||
], | ||
}, | ||
languageOptions: { parser: require('jsonc-eslint-parser') }, | ||
}, | ||
...nx.configs['flat/react'], | ||
{ | ||
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], | ||
// Override or add rules here | ||
rules: {}, | ||
}, | ||
{ ignores: ['public', '.cache', 'node_modules'] }, | ||
]; |
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,22 @@ | ||
module.exports = { | ||
displayName: 'masonry', | ||
preset: 'react-native', | ||
resolver: '@nx/jest/plugins/resolver', | ||
moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'], | ||
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'], | ||
moduleNameMapper: { | ||
'\\.svg$': '@nx/react-native/plugins/jest/svg-mock', | ||
}, | ||
transform: { | ||
'^.+.(js|ts|tsx)$': [ | ||
'babel-jest', | ||
{ | ||
configFile: __dirname + '/.babelrc.js', | ||
}, | ||
], | ||
'^.+.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': require.resolve( | ||
'react-native/jest/assetFileTransformer.js' | ||
), | ||
}, | ||
coverageDirectory: '../../coverage/ui/masonry', | ||
}; |
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,27 @@ | ||
{ | ||
"name": "@infinite-list/masonry", | ||
"version": "0.0.1", | ||
"peerDependencies": { | ||
"react": "18.2.0", | ||
"react-native": "0.74.1" | ||
}, | ||
"exports": { | ||
"./react": { | ||
"types": "./react.esm.d.ts", | ||
"default": "./react.esm.js" | ||
}, | ||
"./react-native": { | ||
"types": "./react-native.esm.d.ts", | ||
"import": "./react-native.esm.js" | ||
} | ||
}, | ||
"dependencies": { | ||
"@infinite-list/data-model": "workspace:*", | ||
"@infinite-list/scroller": "workspace:*" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"main": "./index.js", | ||
"types": "./index.d.ts" | ||
} |
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 @@ | ||
{ | ||
"name": "masonry", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "ui/masonry/src", | ||
"projectType": "library", | ||
"tags": [], | ||
"targets": {} | ||
} |
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,42 @@ | ||
const { withNx } = require('@nx/rollup/with-nx'); | ||
|
||
module.exports = withNx( | ||
{ | ||
// main: './src/index.ts', | ||
additionalEntryPoints: [], | ||
outputPath: '../../dist/ui/masonry', | ||
tsConfig: './tsconfig.lib.json', | ||
compiler: 'babel', | ||
format: ['esm'], | ||
assets: [{ input: '.', output: '.', glob: '*.md' }], | ||
}, | ||
{ | ||
input: ['./src/react-native', './src/react'], | ||
output: { | ||
entryFileNames: (chunk) => { | ||
if (chunk.facadeModuleId.endsWith('src/react-native/index.ts')) { | ||
return 'react-native.esm.js'; | ||
} | ||
if (chunk.facadeModuleId.endsWith('src/react/index.ts')) { | ||
return 'react.esm.js'; | ||
} | ||
|
||
// if (chunk.facadeModuleId.endsWith('src/react-native')) { | ||
// return 'react-native.esm.js' | ||
// } | ||
|
||
// if (chunk.facadeModuleId.endsWith('src/web')) { | ||
// return 'web.esm.js' | ||
// } | ||
// if (chunk.facadeModuleId.includes('/module')) { | ||
// const dir = path.dirname(chunk.facadeModuleId); | ||
// return 'module/' + path.basename(dir) + '.js'; | ||
// } | ||
}, | ||
}, | ||
|
||
// Provide additional rollup configuration here. See: https://rollupjs.org/configuration-options | ||
// e.g. | ||
// output: { sourcemap: true }, | ||
} | ||
); |
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,38 @@ | ||
import { Fragment } from 'react'; | ||
|
||
import { GenericItemT, RecycleStateResult } from '@infinite-list/data-model'; | ||
import { ColumnStateRendererProps } from './types'; | ||
|
||
import RecycleItem from './RecycleItem'; | ||
import SpaceItem from './SpaceItem'; | ||
|
||
const ColumnStateRenderer = <ItemT extends GenericItemT>( | ||
props: ColumnStateRendererProps<ItemT> | ||
) => { | ||
const { state, columnIndex, columnDimensions, ...rest } = props; | ||
const current = state[0] as RecycleStateResult<ItemT>; | ||
return ( | ||
<Fragment> | ||
{current.spaceState.map((data) => ( | ||
<SpaceItem | ||
{...rest} | ||
data={data} | ||
key={data.key} | ||
columnIndex={columnIndex} | ||
columnDimension={columnDimensions[columnIndex]} | ||
/> | ||
))} | ||
{current.recycleState.map((data) => ( | ||
<RecycleItem | ||
{...rest} | ||
data={data} | ||
key={data.key} | ||
columnIndex={columnIndex} | ||
columnDimension={columnDimensions[columnIndex]} | ||
/> | ||
))} | ||
</Fragment> | ||
); | ||
}; | ||
|
||
export default ColumnStateRenderer; |
Oops, something went wrong.