-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:unkeyed/unkey into feat/logs-v2-dat…
…a-fetching
- Loading branch information
Showing
19 changed files
with
719 additions
and
93 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
apps/engineering/content/design/components/date-time.example.tsx
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,68 @@ | ||
"use client"; | ||
import { RenderComponentWithSnippet } from "@/app/components/render"; | ||
import { Row } from "@/app/components/row"; | ||
import { Button, DateTime, type Range } from "@unkey/ui"; | ||
import { useState } from "react"; | ||
|
||
type TimeUnit = { | ||
HH: string; | ||
mm: string; | ||
ss: string; | ||
}; | ||
|
||
export const DateTimeExample: React.FC = () => { | ||
const [date, setDate] = useState<Range>(); | ||
const [startTime, setStartTime] = useState<TimeUnit>(); | ||
const [endTime, setEndTime] = useState<TimeUnit>(); | ||
|
||
const handleApply = (newDate?: Range, newStartTime?: TimeUnit, newEndTime?: TimeUnit) => { | ||
newDate ? setDate(newDate) : null; | ||
newStartTime ? setStartTime(newStartTime) : null; | ||
newEndTime ? setEndTime(newEndTime) : null; | ||
}; | ||
const handleChange = (newDate?: Range, newStartTime?: TimeUnit, newEndTime?: TimeUnit) => { | ||
newDate ? setDate(newDate) : null; | ||
newStartTime ? setStartTime(newStartTime) : null; | ||
newEndTime ? setEndTime(newEndTime) : null; | ||
}; | ||
|
||
return ( | ||
<RenderComponentWithSnippet> | ||
<Row> | ||
<div className="flex flex-col w-full"> | ||
<div className="w-full p-4 border border-1-gray-12 h-32"> | ||
<div className="w-full "> | ||
<p className="m-0 p-0"> | ||
Date Range: <span>{date?.from?.toLocaleDateString() ?? "no date"}</span> -{" "} | ||
<span>{date?.to?.toLocaleDateString() ?? "no date"}</span> | ||
</p> | ||
<p className="m-0 p-0"> | ||
Time Span: <span>{`${startTime?.HH}:${startTime?.mm}:${startTime?.ss}`}</span> -{" "} | ||
<span>{`${endTime?.HH}:${endTime?.mm}:${endTime?.ss}`}</span> | ||
</p> | ||
</div> | ||
</div> | ||
<div className="flex flex-col w-full pt-12 justify-center items-center"> | ||
<DateTime | ||
onChange={(date?: Range, startTime?: TimeUnit, endTime?: TimeUnit) => | ||
handleChange(date, startTime, endTime) | ||
} | ||
> | ||
<DateTime.Calendar mode="range" /> | ||
<DateTime.TimeInput type="range" /> | ||
<DateTime.Actions> | ||
<Button | ||
className="w-full" | ||
onClick={() => handleApply(date, startTime, endTime)} | ||
variant={"primary"} | ||
> | ||
Apply Filter | ||
</Button> | ||
</DateTime.Actions> | ||
</DateTime> | ||
</div> | ||
</div> | ||
</Row> | ||
</RenderComponentWithSnippet> | ||
); | ||
}; |
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,17 @@ | ||
--- | ||
title: DateTime | ||
--- | ||
import { Button } from "@unkey/ui" | ||
import { RenderComponentWithSnippet } from "@/app/components/render" | ||
import { Row } from "@/app/components/row" | ||
import { DateTimeExample } from "./date-time.example" | ||
|
||
|
||
## Example | ||
|
||
<DateTimeExample/> | ||
|
||
|
||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Copyright © Nucleo | ||
* Version 1.3, January 3, 2024 | ||
* Nucleo Icons | ||
* https://nucleoapp.com/ | ||
* - Redistribution of icons is prohibited. | ||
* - Icons are restricted for use only within the product they are bundled with. | ||
* | ||
* For more details: | ||
* https://nucleoapp.com/license | ||
*/ | ||
|
||
// biome-ignore lint: React in this context is used throughout, so biome will change to types because no APIs are used even though React is needed. | ||
import React from "react"; | ||
import type { IconProps } from "../props"; | ||
|
||
export const ChevronLeft: React.FC<IconProps> = (props: IconProps) => { | ||
return ( | ||
<svg {...props} height="18" width="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"> | ||
<g fill="currentColor"> | ||
<path | ||
d="M11.5 15.25L5.25 9L11.5 2.75" | ||
fill="none" | ||
stroke="currentColor" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeWidth="1.5" | ||
/> | ||
</g> | ||
</svg> | ||
); | ||
}; |
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,32 @@ | ||
/** | ||
* Copyright © Nucleo | ||
* Version 1.3, January 3, 2024 | ||
* Nucleo Icons | ||
* https://nucleoapp.com/ | ||
* - Redistribution of icons is prohibited. | ||
* - Icons are restricted for use only within the product they are bundled with. | ||
* | ||
* For more details: | ||
* https://nucleoapp.com/license | ||
*/ | ||
|
||
// biome-ignore lint: React in this context is used throughout, so biome will change to types because no APIs are used even though React is needed. | ||
import React from "react"; | ||
import type { IconProps } from "../props"; | ||
|
||
export const ChevronRight: React.FC<IconProps> = (props: IconProps) => { | ||
return ( | ||
<svg {...props} height="18" width="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"> | ||
<g fill="currentColor"> | ||
<path | ||
d="M6.5 2.75L12.75 9L6.5 15.25" | ||
fill="none" | ||
stroke="currentColor" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeWidth="1.5" | ||
/> | ||
</g> | ||
</svg> | ||
); | ||
}; |
Oops, something went wrong.