-
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.
Merge pull request #18 from wpdas/staging
Staging: News from beta 26, added collapse list component, docs updated
- Loading branch information
Showing
14 changed files
with
181 additions
and
19 deletions.
There are no files selected for viewing
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,57 @@ | ||
import { useState } from "alem"; | ||
import styled from "styled-components"; | ||
|
||
type Props = { | ||
title: string; | ||
children: React.ReactElement; | ||
initialState?: "open" | "closed"; | ||
onClick?: (isOpen: boolean) => void; | ||
}; | ||
|
||
const CollapseList = ({ title, children, initialState, onClick }: Props) => { | ||
const Content = styled.div<{ open: boolean }>` | ||
overflow: hidden; | ||
height: ${(props) => (props.open ? "fit-content" : "0px")}; | ||
`; | ||
|
||
const TitleButton = styled.button` | ||
display: flex; | ||
align-items: center; | ||
background-color: transparent; | ||
border: none; | ||
margin: 0; | ||
padding: 0; | ||
h3:hover, | ||
:hover { | ||
color: rgb(68, 152, 224); | ||
} | ||
span { | ||
margin-top: 6px; | ||
} | ||
`; | ||
|
||
const [open, setOpen] = useState(initialState === "open"); | ||
|
||
return ( | ||
<> | ||
<TitleButton | ||
onClick={() => { | ||
if (onClick) onClick(!open); | ||
setOpen(!open); | ||
}} | ||
> | ||
<h3>{title}</h3> | ||
{open ? ( | ||
<span className="material-symbols-outlined">arrow_drop_up</span> | ||
) : ( | ||
<span className="material-symbols-outlined">arrow_drop_down</span> | ||
)} | ||
</TitleButton> | ||
<Content open={open}>{children}</Content> | ||
</> | ||
); | ||
}; | ||
|
||
export default CollapseList; |
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
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Markdown } from 'alem'; | ||
|
||
const GetAlemEnvironment = () => { | ||
const mdContent = Buffer.from(`IyBHZXQgQWxlbSBFbnZpcm9ubWVudAoKVXNlZnVsIGZlYXR1cmUgdG8gZ2V0IHRoZSBjdXJyZW50IGVudmlyb25tZW50IHZhbHVlLiBVc2UgYC5lbnZgIHRvIHNldCB0aGUgZW52aXJvbm1lbnQuCgpgYGBzaAojIHNldCB0aGUgcHJvamVjdCdzIGVudmlyb25tZW50Ck5PREVfRU5WPXN0YWdpbmcKYGBgCgpgYGB0c3gKaW1wb3J0IHsgZ2V0QWxlbUVudmlyb25tZW50IH0gZnJvbSAiYWxlbSI7Cgpjb25zb2xlLmxvZyhnZXRBbGVtRW52aXJvbm1lbnQoKSk7IC8vIHN0YWdpbmcKYGBgCg==`, "base64").toString("utf-8"); | ||
return <Markdown text={mdContent} /> | ||
} | ||
|
||
export default GetAlemEnvironment; |
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,14 @@ | ||
# Get Alem Environment | ||
|
||
Useful feature to get the current environment value. Use `.env` to set the environment. | ||
|
||
```sh | ||
# set the project's environment | ||
NODE_ENV=staging | ||
``` | ||
|
||
```tsx | ||
import { getAlemEnvironment } from "alem"; | ||
|
||
console.log(getAlemEnvironment()); // staging | ||
``` |
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
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
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