-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b60d08f
commit c6007b0
Showing
6 changed files
with
100 additions
and
6 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 |
---|---|---|
@@ -1,9 +1,21 @@ | ||
import React from 'react'; | ||
|
||
export default function ZapIcon(props: React.SVGProps<SVGSVGElement>) { | ||
type ZapIconProps = React.SVGProps<SVGSVGElement> & { | ||
/** | ||
* (optional) The color of the icon. | ||
* Defaults to `white`. | ||
*/ | ||
color?: string; | ||
}; | ||
|
||
export default function ZapIcon(props: ZapIconProps) { | ||
return ( | ||
<svg {...props} width="18" height="19" viewBox="0 0 18 19" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M9 18.5C4.02944 18.5 0 14.4706 0 9.5C0 4.52944 4.02944 0.5 9 0.5C13.9706 0.5 18 4.52944 18 9.5C18 14.4706 13.9706 18.5 9 18.5ZM9.00199 4.5C9.48462 4.5 9.87276 4.89709 9.86175 5.37961L9.74851 10.3413C9.73923 10.7478 9.40697 11.0726 9.00027 11.0726C8.59337 11.0726 8.26102 10.7475 8.25202 10.3407L8.14221 5.37901C8.13154 4.89672 8.51958 4.5 9.00199 4.5ZM10 12.9089C9.99545 13.4635 9.53637 13.9089 9.00002 13.9089C8.44548 13.9089 7.99549 13.4635 8.00003 12.9089C7.99549 12.3635 8.44548 11.9181 9.00002 11.9181C9.53637 11.9181 9.99545 12.3635 10 12.9089Z" fill="white"/> | ||
<path | ||
fill-rule="evenodd" | ||
clip-rule="evenodd" | ||
d="M9 18.5C4.02944 18.5 0 14.4706 0 9.5C0 4.52944 4.02944 0.5 9 0.5C13.9706 0.5 18 4.52944 18 9.5C18 14.4706 13.9706 18.5 9 18.5ZM9.00199 4.5C9.48462 4.5 9.87276 4.89709 9.86175 5.37961L9.74851 10.3413C9.73923 10.7478 9.40697 11.0726 9.00027 11.0726C8.59337 11.0726 8.26102 10.7475 8.25202 10.3407L8.14221 5.37901C8.13154 4.89672 8.51958 4.5 9.00199 4.5ZM10 12.9089C9.99545 13.4635 9.53637 13.9089 9.00002 13.9089C8.44548 13.9089 7.99549 13.4635 8.00003 12.9089C7.99549 12.3635 8.44548 11.9181 9.00002 11.9181C9.53637 11.9181 9.99545 12.3635 10 12.9089Z" | ||
fill={props.color ?? 'white'}/> | ||
</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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
import React from 'react'; | ||
|
||
export default function PermissionsDialog() { | ||
return <div>PermissionsDialog</div>; | ||
} |
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,45 @@ | ||
import { Adjust } from '@/components/icons/Adjust'; | ||
import ZapIcon from '@/components/icons/ZapIcon'; | ||
import React from 'react'; | ||
|
||
interface SummaryRowProps { | ||
/** | ||
* A description of the requested permission. | ||
* Example: "Read your contacts" | ||
*/ | ||
description: string; | ||
/** | ||
* An optional warning message to display. | ||
*/ | ||
warning: string | null; | ||
/** | ||
* TODO: pass in the permission object and use | ||
* a helper function to determine which icon based on the metadata. | ||
*/ | ||
// icon: string; | ||
} | ||
|
||
/** | ||
* A row summarizing a requested permission. | ||
* It has the description of the permission and an optional warning icon. | ||
*/ | ||
export default function SummaryRow({ description, warning }: SummaryRowProps) { | ||
return ( | ||
<div className='w-full flex justify-between content-center p-2 space-x-4'> | ||
<div className='flex space-x-1'> | ||
<div className='h-8 w-8 bg-gray-50 p-1.5'> | ||
{/* TODO: placeholder icon */} | ||
<Adjust /> | ||
</div> | ||
<div className='flex flex-col justify-center text-sm font-medium text-gray-900'> | ||
{description} | ||
</div> | ||
</div> | ||
{warning ? ( | ||
<div className='flex flex-col justify-center'> | ||
<ZapIcon color='#FF6240' /> | ||
</div> | ||
) : null} | ||
</div> | ||
) | ||
} |
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,29 @@ | ||
import SummaryRow from '@/permissions/SummaryRow'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
const meta: Meta<typeof SummaryRow> = { | ||
title: 'Permissions/SummaryRow', | ||
tags: ['autodocs'], | ||
component: SummaryRow, | ||
|
||
parameters: { | ||
layout: 'centered', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof SummaryRow>; | ||
|
||
export const HasWarning: Story = { | ||
args: { | ||
description: 'Access network keys or passwords', | ||
warning: 'This permission is dangerous', | ||
}, | ||
}; | ||
|
||
export const NoWarning: Story = { | ||
args: { | ||
description: 'Send notifications', | ||
warning: null, | ||
}, | ||
}; |