Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Next Next commit
working
  • Loading branch information
Rogin Farrer committed May 26, 2024
commit c7e0631bb901ebcea5bd11110e9808f7aa1d6138
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"eslint-config-collapsed": "workspace:*",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"parcel": "^2.8.2",
"ts-jest": "^29.0.3",
"tslib": "^2.4.1",
"tsup": "^8"
Expand Down
25 changes: 25 additions & 0 deletions packages/core/sandbox-app/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
html {
font-family:
system-ui,
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
Oxygen,
Ubuntu,
Cantarell,
"Open Sans",
"Helvetica Neue",
sans-serif;
}
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100dvh;
}

.collapse {
background-color: skyblue;
}
22 changes: 22 additions & 0 deletions packages/core/sandbox-app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script type="module" src="index.ts"></script>
<link rel="stylesheet" href="index.css" />
<title>My First Parcel App</title>
</head>
<body>
<button type="button">Toggle</button>
<div class="collapse">
<div class="inner">
<p>Oh, hello</p>
<p>Oh, hello</p>
<p>Oh, hello</p>
<p>Oh, hello</p>
<p>Oh, hello</p>
<p>Oh, hello</p>
</div>
</div>
</body>
</html>
15 changes: 15 additions & 0 deletions packages/core/sandbox-app/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Collapse } from "../src";

const btn = document.querySelector("button") as HTMLButtonElement;
const collapse = document.querySelector(".collapse") as HTMLDivElement;
let isExpanded = true;

let instance = new Collapse({
getCollapseElement: () => collapse,
getToggleElement: () => btn,
isExpanded,
onExpandedChange(state) {
isExpanded = state;
instance.setOptions((prev) => ({ ...prev, isExpanded: state }));
},
});
Loading