refactor(web): 亮色模式的部分配色

pull/13/head
moonrailgun 4 years ago
parent f76ace6069
commit be788f4619

@ -34,7 +34,7 @@ export const FullModal: React.FC<FullModalProps> = React.memo((props) => {
return ( return (
<div <div
className={clsx( className={clsx(
'fixed left-0 right-0 top-0 bottom-0 z-10 bg-gray-800 flex justify-center items-center', 'fixed left-0 right-0 top-0 bottom-0 z-10 bg-content-light dark:bg-content-dark flex justify-center items-center',
{ {
'opacity-0': !visible, 'opacity-0': !visible,
} }
@ -48,7 +48,10 @@ export const FullModal: React.FC<FullModalProps> = React.memo((props) => {
className="absolute right-8 top-8 cursor-pointer flex flex-col" className="absolute right-8 top-8 cursor-pointer flex flex-col"
onClick={handleClose} onClick={handleClose}
> >
<Icon className="text-2xl border-2 rounded-1/2" icon="mdi:close" /> <Icon
className="text-2xl border-2 rounded-1/2 border-gray-900 dark:border-gray-100"
icon="mdi:close"
/>
<span className="text-center mt-0.5 font-bold">ESC</span> <span className="text-center mt-0.5 font-bold">ESC</span>
</div> </div>
)} )}

@ -1,5 +1,5 @@
.pill-tabs.ant-tabs.ant-tabs-card { .pill-tabs.ant-tabs.ant-tabs-card {
@apply text-gray-100; @apply text-gray-900 dark:text-gray-100;
.ant-tabs-nav { .ant-tabs-nav {
@apply px-2 py-3 m-0 text-base; @apply px-2 py-3 m-0 text-base;
@ -12,7 +12,7 @@
border: 0; border: 0;
margin: 2px; margin: 2px;
padding: 2px 8px; padding: 2px 8px;
@apply text-gray-200 bg-opacity-0 bg-white; @apply text-gray-800 dark:text-gray-200 bg-opacity-0 bg-black dark:bg-white;
&.ant-tabs-tab-active, &.ant-tabs-tab-active,
&:hover, &:hover,
@ -20,7 +20,7 @@
@apply rounded bg-opacity-20; @apply rounded bg-opacity-20;
.ant-tabs-tab-btn { .ant-tabs-tab-btn {
@apply text-white; @apply text-black dark:text-white ;
} }
} }
} }

@ -33,9 +33,9 @@ const SidebarViewMenuItemTitle: React.FC<{
}> = (props) => ( }> = (props) => (
<div <div
className={clsx( className={clsx(
'rounded-sm px-1.5 py-2.5 mb-1 text-gray-300 cursor-pointer hover:bg-black hover:bg-opacity-10 hover:text-gray-200', 'rounded-sm px-1.5 py-2.5 mb-1 text-gray-700 dark:text-gray-300 cursor-pointer hover:bg-black hover:bg-opacity-10 hover:text-gray-800 dark:hover:text-gray-200',
{ {
'bg-black bg-opacity-10 text-white': props.active, 'bg-black bg-opacity-10 text-gray-900 dark:text-white': props.active,
'text-red-500': props.isDanger, 'text-red-500': props.isDanger,
} }
)} )}

@ -1,11 +1,13 @@
import DevContainer from '@/components/DevContainer';
import { FullModalField } from '@/components/FullModal/Field'; import { FullModalField } from '@/components/FullModal/Field';
import { Select } from 'antd'; import { Select, Switch } from 'antd';
import React, { useCallback } from 'react'; import React, { useCallback } from 'react';
import { showToasts, t } from 'tailchat-shared'; import { showToasts, t, useDarkMode } from 'tailchat-shared';
import { useLanguage } from 'tailchat-shared'; import { useLanguage } from 'tailchat-shared';
export const SettingsSystem: React.FC = React.memo(() => { export const SettingsSystem: React.FC = React.memo(() => {
const { language, setLanguage } = useLanguage(); const { language, setLanguage } = useLanguage();
const { darkMode, setDarkMode } = useDarkMode();
const handleChangeLanguage = useCallback( const handleChangeLanguage = useCallback(
(newLang: string) => { (newLang: string) => {
@ -31,6 +33,18 @@ export const SettingsSystem: React.FC = React.memo(() => {
</Select> </Select>
} }
/> />
<DevContainer>
<FullModalField
title={t('暗黑模式')}
content={
<Switch
checked={darkMode}
onChange={(checked) => setDarkMode(checked)}
/>
}
/>
</DevContainer>
</div> </div>
); );
}); });

@ -25,7 +25,11 @@ export const FriendPanel: React.FC = React.memo(() => {
</PillTabPane> </PillTabPane>
<PillTabPane <PillTabPane
tab={ tab={
<Badge className="text-white" size="small" count={send.length}> <Badge
className="text-black dark:text-white"
size="small"
count={send.length}
>
{t('已发送')} {t('已发送')}
</Badge> </Badge>
} }
@ -35,7 +39,11 @@ export const FriendPanel: React.FC = React.memo(() => {
</PillTabPane> </PillTabPane>
<PillTabPane <PillTabPane
tab={ tab={
<Badge className="text-white" size="small" count={received.length}> <Badge
className="text-black dark:text-white"
size="small"
count={received.length}
>
{t('待处理')} {t('待处理')}
</Badge> </Badge>
} }

@ -1,15 +1,15 @@
import React from 'react'; import React from 'react';
import { Icon } from '@iconify/react'; import { Icon } from '@iconify/react';
import { SidebarItem } from '../SidebarItem'; import { SidebarItem } from '../SidebarItem';
import { useDMConverseList } from 'tailchat-shared'; import { t, useDMConverseList } from 'tailchat-shared';
import { SidebarDMItem } from './SidebarDMItem'; import { SidebarDMItem } from './SidebarDMItem';
const SidebarSection: React.FC<{ const SidebarSection: React.FC<{
action: React.ReactNode; action: React.ReactNode;
}> = React.memo((props) => { }> = React.memo((props) => {
return ( return (
<div className="h-10 text-white flex pt-4 px-2"> <div className="h-10 text-gray-900 dark:text-white flex pt-4 px-2">
<span className="flex-1 overflow-hidden overflow-ellipsis text-xs text-gray-300"> <span className="flex-1 overflow-hidden overflow-ellipsis text-xs text-gray-700 dark:text-gray-300">
{props.children} {props.children}
</span> </span>
<div className="text-base opacity-70 hover:opacity-100 cursor-pointer"> <div className="text-base opacity-70 hover:opacity-100 cursor-pointer">
@ -29,17 +29,19 @@ export const Sidebar: React.FC = React.memo(() => {
return ( return (
<div className="p-2"> <div className="p-2">
<SidebarItem <SidebarItem
name="好友" name={t('好友')}
icon={<Icon icon="mdi:account-multiple" />} icon={<Icon icon="mdi:account-multiple" />}
to="/main/personal/friends" to="/main/personal/friends"
/> />
<SidebarItem <SidebarItem
name="插件中心" name={t('插件中心')}
icon={<Icon icon="mdi:puzzle" />} icon={<Icon icon="mdi:puzzle" />}
to="/main/personal/plugins" to="/main/personal/plugins"
/> />
<SidebarSection action={<Icon icon="mdi:plus" />}></SidebarSection> <SidebarSection action={<Icon icon="mdi:plus" />}>
{t('私信')}
</SidebarSection>
{converseList.map((converse) => { {converseList.map((converse) => {
return <SidebarDMItem key={converse._id} converse={converse} />; return <SidebarDMItem key={converse._id} converse={converse} />;

@ -21,7 +21,7 @@ export const SidebarItem: React.FC<SidebarItemProps> = React.memo((props) => {
<Link to={to}> <Link to={to}>
<div <div
className={clsx( className={clsx(
'w-full hover:bg-white hover:bg-opacity-20 cursor-pointer text-white rounded px-2 h-11 flex items-center text-base group mb-0.5', 'w-full hover:bg-white hover:bg-opacity-20 cursor-pointer text-gray-900 dark:text-white rounded px-2 h-11 flex items-center text-base group mb-0.5',
{ {
'bg-white bg-opacity-20': isActive, 'bg-white bg-opacity-20': isActive,
} }
@ -35,7 +35,10 @@ export const SidebarItem: React.FC<SidebarItemProps> = React.memo((props) => {
)} )}
</div> </div>
<Typography.Text className="flex-1 text-white" ellipsis={true}> <Typography.Text
className="flex-1 text-gray-900 dark:text-white"
ellipsis={true}
>
{name} {name}
</Typography.Text> </Typography.Text>

@ -51,7 +51,7 @@ export const NavbarNavItem: React.FC<{
> >
<span <span
className={clsx( className={clsx(
'bg-white w-2 h-2 rounded transition-all duration-300', 'bg-gray-400 dark:bg-white w-2 h-2 rounded transition-all duration-300',
{ {
'h-2 group-hover:h-5': !isActive, 'h-2 group-hover:h-5': !isActive,
'h-10': isActive, 'h-10': isActive,

Loading…
Cancel
Save