Изменить цвет компонента заголовка в Ant Design с помощью стилизованного компонента?CSS

Разбираемся в CSS
Ответить Пред. темаСлед. тема
Anonymous
 Изменить цвет компонента заголовка в Ant Design с помощью стилизованного компонента?

Сообщение Anonymous »


I am using Ant Design alongside styled components for my application.

I have a NavBar which component which uses a H1 Component.

H1.tsx

Код: Выделить всё

import React from 'react';
import { Typography } from 'antd';
import styled from 'styled-components';

const { Title } = Typography;

const TypographyWrapper = styled.div`
font-family: 'Muli', sans-serif;
`;

interface H1Props {
children?: String;
}

export const H1: React.SFC = ({ children, ...rest }) => {
return (


{children}


);
};

export default H1;
Navbar.tsx

Код: Выделить всё

import React from 'react';
import { primary, monochrome } from '../colors/Colors';
import styled from 'styled-components';
import { NavbarConstants } from '../../config/stringConstants';
import H1 from '../typography/H1';

const Wrapper = styled.div`
background-color: ${primary['Blue-400']}
width: 100%;
display: flex;
flex-direction: row;
padding: 30px;
align-items: center;
`;

const StyledH1 = styled(H1)`
color: ${monochrome.offWhite};
`;

interface NavbarProps {}

export const Navbar: React.SFC = () => {
return (

{NavbarConstants.NAVBAR_TITLE}

);
};
I am looking to change the color of the H1 text i.e.

Код: Выделить всё

color: ${monochrome.offWhite}
but I cannot seem to target the component at all.

From the console, it is override by

Код: Выделить всё

h1.ant-typography, .ant-typography h1
. I tried variations of selectors to target this, but to no avail.

How can I modify the text color using styled components?


Источник: https://stackoverflow.com/questions/590 ... -component
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Удалить TransitType из Apple Design Design Pkpass Design
    Anonymous » » в форуме Php
    0 Ответы
    12 Просмотры
    Последнее сообщение Anonymous
  • Как изменить стиль компонента Ant-Design Select?
    Anonymous » » в форуме CSS
    0 Ответы
    23 Просмотры
    Последнее сообщение Anonymous
  • Как изменить стиль компонента Ant-Design Select?
    Anonymous » » в форуме CSS
    0 Ответы
    35 Просмотры
    Последнее сообщение Anonymous
  • Как изменить цвет текста и цвет фона компонента Ant-Tooltip
    Anonymous » » в форуме Html
    0 Ответы
    30 Просмотры
    Последнее сообщение Anonymous
  • Как изменить цвет текста и цвет фона компонента Ant-Tooltip
    Anonymous » » в форуме CSS
    0 Ответы
    16 Просмотры
    Последнее сообщение Anonymous

Вернуться в «CSS»